detail.js 6.2 KB

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