detail.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. // pages/order/detail/detail.js
  2. var app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. btnInfo: app.globalData.btnInfo,
  9. order_no:"",
  10. adder:"1号",
  11. uptime:'9:00-18:00',
  12. logistics1:[
  13. {
  14. title:'请您打包好待清洗衣物,前往网点存衣 ',
  15. desc:"建议使用一次性包装袋打包衣物",
  16. foot:""
  17. },
  18. {
  19. title:'衣物已收到 ',
  20. desc:"衣物将被送往洗护中心清洗",
  21. foot:""
  22. },
  23. {
  24. title:'送洗途中 ',
  25. desc:"衣物送往",
  26. foot:""
  27. },
  28. {
  29. title:'清洗中 ',
  30. desc:"衣物正在",
  31. foot:"进行清洗"
  32. },
  33. {
  34. title:'送回途中 ',
  35. desc:"衣物正在送回途中",
  36. foot:""
  37. },
  38. {
  39. title:'管家已存衣 ',
  40. desc:"请尽快取走您的衣物",
  41. foot:""
  42. },
  43. ],
  44. logistics2:[
  45. {
  46. title:'请您打包好待清洗衣物,等待工作人员上门取衣 ',
  47. desc:"建议使用一次性打包袋打包衣物,上门服务时间:",
  48. },
  49. {
  50. title:'衣物已收到 ',
  51. desc:"衣物将被送往洗护中心清洗",
  52. },
  53. {
  54. title:'送洗途中 ',
  55. desc:"衣物送往{{adder}}洗护中心途中",
  56. },
  57. {
  58. title:'清洗中 ',
  59. desc:"衣物正在{{adder}}洗护中心进行清洗",
  60. },
  61. {
  62. title:'送回途中 ',
  63. desc:"衣物正在送回途中",
  64. },
  65. {
  66. title:'管家已存衣 ',
  67. desc:"请尽快取走您的衣物",
  68. },
  69. {
  70. title:'您已取回衣服 ',
  71. desc:"长期保存前先拆除外包装后再放入衣橱,避免因温度差异产生的水汽导致衣物发霉",
  72. },
  73. ]
  74. },
  75. /**
  76. * 生命周期函数--监听页面加载
  77. */
  78. onLoad: function (options) {
  79. let that = this
  80. that.setData({
  81. order_no:options.order_no?options.order_no:""
  82. })
  83. // setTimeout(() => {
  84. // if(options.subscribe==1){
  85. // that.opensubscribe()
  86. // }
  87. // }, 1000);
  88. // console.log(options.order_no)
  89. },
  90. onShow(){
  91. this.detail(this.data.order_no)
  92. },
  93. opensubscribe(){
  94. wx.showToast({
  95. title: '开启订阅授权',
  96. icon: 'none',
  97. duration: 1200
  98. })
  99. wx.requestSubscribeMessage({
  100. tmplIds: ['VGlAo-fOukIVSjdmOS5_-9IldrNplzrbKzZzWI2rFuc'],
  101. success (res) {
  102. console.log('成功-'+res)
  103. }
  104. })
  105. },
  106. goreport(){
  107. wx.navigateTo({
  108. url: '/pages/order/cleanReport/cleanReport?id='+this.data.orderinfo.id,
  109. })
  110. },
  111. backBtn() {
  112. wx.switchTab({
  113. url: '/pages/tabber/order/index',
  114. })
  115. },
  116. home(){
  117. wx.switchTab({
  118. url: '/pages/tabber/home/index',
  119. })
  120. },
  121. location(){
  122. console.log(this.data.orderinfo.network.lat)
  123. wx.openLocation({
  124. latitude: Number(this.data.orderinfo.network.lat),
  125. longitude: Number(this.data.orderinfo.network.lng),
  126. });
  127. },
  128. rightClick() {
  129. console.log(1);
  130. },
  131. detail(order) {
  132. var that = this;
  133. app.api.useApi(app.globalData.baseAppUrl + "api/order_detail", {
  134. order_no: order,
  135. }, "get").then(function (res) {
  136. if (res.code != 200) {
  137. wx.showLoading({
  138. title: res.message.msg,
  139. })
  140. setTimeout(function () {
  141. wx.hideLoading({
  142. success: (res) => { },
  143. })
  144. }, 2000);
  145. } else {
  146. console.log(res.message.data);
  147. that.setData({
  148. orderinfo: res.message.data,
  149. address: res.message.address.address,
  150. code: res.message.address.phone,
  151. name: res.message.address.username,
  152. address_id:res.message.address.id,
  153. useraddr: res.message.address,
  154. })
  155. }
  156. }).catch(function (err) {
  157. console.log(222);
  158. })
  159. },
  160. changeClose1(e) {
  161. this.setData({
  162. show1: !this.data.show1
  163. })
  164. },
  165. copy(e){
  166. wx.setClipboardData({
  167. data: e.currentTarget.dataset.no,
  168. success (res) {
  169. wx.showLoading({
  170. title: '复制成功',
  171. })
  172. setTimeout(function () {
  173. wx.hideLoading({
  174. success: (res) => { },
  175. })
  176. }, 1000);
  177. }
  178. })
  179. },
  180. open(e){
  181. let that = this
  182. var no=e.currentTarget.dataset.no;
  183. var network_id=e.currentTarget.dataset.network_id;
  184. var is_deposit=e.currentTarget.dataset.is_deposit;
  185. if(that.data.orderinfo.logistics_status!=2&&that.data.orderinfo.logistics_status!=4){
  186. wx.scanCode({
  187. onlyFromCamera: true,
  188. success (res) {
  189. console.log(res);
  190. var reg= new RegExp('(^)?network_id=([^&]*)(&|$)orde_num=([^&]*)(&|$)','i')
  191. var str= res.result.match(reg);
  192. wx.redirectTo({
  193. url: '/pages/order/deposit/deposit?order_type='+no+"&network_id="+network_id+"&is_deposit="+is_deposit+"&order_num="+str[4]+"&device_id="+str[4],
  194. })
  195. }
  196. })
  197. }
  198. // wx.navigateTo({
  199. // url: '/pages/order/deposit/deposit?order_type='+no+"&network_id="+network_id+"&is_deposit="+is_deposit,
  200. // })
  201. },
  202. logistic_code(e){
  203. console.log(e)
  204. var logistic_code=e.currentTarget.dataset.no;
  205. var status=e.currentTarget.dataset.status;
  206. if(status==1||status==6){
  207. wx.showModal({
  208. title: '存/取件码',
  209. content: logistic_code
  210. })
  211. }
  212. },
  213. pay(){
  214. wx.redirectTo({
  215. url: "/pages/my/cashier/cashier?order_no="+this.data.order_no,
  216. })
  217. },
  218. // onUnload:function(){
  219. // wx.switchTab({
  220. // url: '/pages/tabber/order/index'
  221. // })
  222. // },
  223. closOrder(e) {
  224. console.log(e);
  225. var that = this;
  226. var order = e.currentTarget.dataset.oid
  227. app.api.useApi(app.globalData.baseAppUrl + "api/CancelOrders", {
  228. order_id: that.data.order_no,
  229. }, "post").then(function (res) {
  230. if (res.code != 200) {
  231. console.log(res.message.msg)
  232. wx.showToast({
  233. title: res.message.msg,
  234. })
  235. // that.detail(that.data.order_no);
  236. } else {
  237. wx.showLoading({
  238. title: res.message.msg,
  239. })
  240. setTimeout(() => {
  241. wx.navigateBack()
  242. }, 1000);
  243. }
  244. wx.hideLoading();
  245. }).catch(function (err) {
  246. console.log(222);
  247. })
  248. },
  249. })