detail.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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. },
  71. /**
  72. * 生命周期函数--监听页面加载
  73. */
  74. onLoad: function (options) {
  75. this.setData({
  76. order_no:options.order_no?options.order_no:""
  77. })
  78. },
  79. onShow(){
  80. this.detail(this.data.order_no)
  81. },
  82. goreport(){
  83. wx.navigateTo({
  84. url: '/pages/order/cleanReport/cleanReport?id='+this.data.orderinfo.id,
  85. })
  86. },
  87. backBtn() {
  88. wx.switchTab({
  89. url: '/pages/tabber/order/index',
  90. })
  91. },
  92. home(){
  93. wx.switchTab({
  94. url: '/pages/tabber/home/index',
  95. })
  96. },
  97. location(){
  98. console.log(this.data.orderinfo.network.lat)
  99. wx.openLocation({
  100. latitude: Number(this.data.orderinfo.network.lat),
  101. longitude: Number(this.data.orderinfo.network.lng),
  102. });
  103. },
  104. rightClick() {
  105. console.log(1);
  106. },
  107. detail(order) {
  108. var that = this;
  109. app.api.useApi(app.globalData.baseAppUrl + "api/order_detail", {
  110. order_no: order,
  111. }, "get").then(function (res) {
  112. if (res.code != 200) {
  113. wx.showLoading({
  114. title: res.message.msg,
  115. })
  116. setTimeout(function () {
  117. wx.hideLoading({
  118. success: (res) => { },
  119. })
  120. }, 2000);
  121. } else {
  122. console.log(res.message.data);
  123. that.setData({
  124. orderinfo: res.message.data,
  125. address: res.message.address.address,
  126. code: res.message.address.phone,
  127. name: res.message.address.username,
  128. address_id:res.message.address.id,
  129. useraddr: res.message.address,
  130. })
  131. }
  132. }).catch(function (err) {
  133. console.log(222);
  134. })
  135. },
  136. changeClose1(e) {
  137. this.setData({
  138. show1: !this.data.show1
  139. })
  140. },
  141. copy(e){
  142. wx.setClipboardData({
  143. data: e.currentTarget.dataset.no,
  144. success (res) {
  145. wx.showLoading({
  146. title: '复制成功',
  147. })
  148. setTimeout(function () {
  149. wx.hideLoading({
  150. success: (res) => { },
  151. })
  152. }, 1000);
  153. }
  154. })
  155. },
  156. open(e){
  157. var no=e.currentTarget.dataset.no;
  158. var network_id=e.currentTarget.dataset.network_id;
  159. var is_deposit=e.currentTarget.dataset.is_deposit;
  160. // wx.navigateTo({
  161. // url: '/pages/order/deposit/deposit?order_type='+no+"&network_id="+network_id+"&is_deposit="+is_deposit,
  162. // })
  163. wx.scanCode({
  164. onlyFromCamera: true,
  165. success (res) {
  166. console.log(res);
  167. var reg= new RegExp('(^)?network_id=([^&]*)(&|$)orde_num=([^&]*)(&|$)','i')
  168. var str= res.result.match(reg);
  169. wx.redirectTo({
  170. url: '/pages/order/deposit/deposit?order_type='+no+"&network_id="+network_id+"&is_deposit="+is_deposit+"&order_num="+str[4]+"&device_id="+str[4],
  171. })
  172. }
  173. })
  174. },
  175. logistic_code(e){
  176. var logistic_code=e.currentTarget.dataset.no;
  177. var status=e.currentTarget.dataset.status;
  178. if(status==1||status==6){
  179. wx.showModal({
  180. title: '存/取件码',
  181. content: logistic_code
  182. })
  183. }
  184. },
  185. pay(){
  186. wx.redirectTo({
  187. url: "/pages/my/cashier/cashier?order_no="+this.data.order_no,
  188. })
  189. },
  190. // onUnload:function(){
  191. // wx.switchTab({
  192. // url: '/pages/tabber/order/index'
  193. // })
  194. // },
  195. closOrder(e) {
  196. console.log(e);
  197. var that = this;
  198. var order = e.currentTarget.dataset.oid
  199. app.api.useApi(app.globalData.baseAppUrl + "api/CancelOrders", {
  200. order_id: that.data.order_no,
  201. }, "post").then(function (res) {
  202. if (res.code != 200) {
  203. console.log(res.message.msg)
  204. wx.showToast({
  205. title: res.message.msg,
  206. })
  207. // that.detail(that.data.order_no);
  208. } else {
  209. wx.showLoading({
  210. title: res.message.msg,
  211. })
  212. setTimeout(() => {
  213. wx.navigateBack()
  214. }, 1000);
  215. }
  216. wx.hideLoading();
  217. }).catch(function (err) {
  218. console.log(222);
  219. })
  220. },
  221. })