detail.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. loading: true,
  5. sa_logisticsid: null,
  6. tabsActive: 0,
  7. tabsList: [{
  8. label: "详细信息",
  9. icon: "icon-tabchanpin"
  10. }, {
  11. label: "物流查询",
  12. icon: "icon-tabfujian1",
  13. model: "#Query"
  14. }, {
  15. label: "装箱明细",
  16. icon: "icon-tabcaozuojilu1",
  17. model: "#Binding"
  18. }, {
  19. label: "附件",
  20. icon: "icon-tabfujian1",
  21. model: "#Yl_Attachment"
  22. }, ]
  23. },
  24. onLoad(options) {
  25. this.setData({
  26. sa_logisticsid: options.id
  27. });
  28. this.getDetail(true);
  29. getApp().globalData.Language.getLanguagePackage(this, '出货详情');
  30. },
  31. /* 获取详情 */
  32. getDetail(init = false, show = true) {
  33. _Http.basic({
  34. "id": 20221204201804,
  35. "content": {
  36. nocache: true,
  37. "sa_logisticsid": this.data.sa_logisticsid
  38. }
  39. }, show).then(res => {
  40. console.log("出货详情", res)
  41. if (res.code != '1') return wx.showToast({
  42. title: res.msg,
  43. icon: "none"
  44. });
  45. this.setPreview(res.data[0]);
  46. this.setData({
  47. detail: res.data[0],
  48. loading: false
  49. });
  50. if (init) this.partialRenewal(true)
  51. })
  52. },
  53. /* 设置详情信息 */
  54. setPreview(data) {
  55. let list1 = [{
  56. label: "物流单号",
  57. value: data.logisticno
  58. }, {
  59. label: "状态",
  60. value: data.status == '审核' ? getApp().globalData.Language.getMapText('待收货') : getApp().globalData.Language.getMapText('已收货')
  61. }, {
  62. label: "收货人",
  63. value: data.name
  64. }, {
  65. label: "收货地址",
  66. value: data.address
  67. }, {
  68. label: "快递公司",
  69. value: data.logiscomp_enterprisename || data.logiscompname
  70. }, {
  71. label: "快递单号",
  72. value: data.logisticno
  73. }, {
  74. label: "运费状态",
  75. value: data.paytype
  76. }, {
  77. label: "运费",
  78. value: data.freightamount
  79. }, {
  80. label: "备注",
  81. value: data.remarks
  82. }, ],
  83. list2 = [{
  84. label: "创建人",
  85. value: data.createby
  86. }, {
  87. label: "创建时间",
  88. value: data.createdate
  89. }, {
  90. label: "审核人",
  91. value: data.checkby
  92. }, {
  93. label: "审核时间",
  94. value: data.checkdate
  95. }, {
  96. label: "收货人",
  97. value: data.receiveby
  98. }, {
  99. label: "收货时间",
  100. value: data.receivedate
  101. }];
  102. this.setData({
  103. list1,
  104. list2
  105. })
  106. },
  107. //tabs 切换
  108. tabsChange({
  109. detail
  110. }) {
  111. this.setData({
  112. tabsActive: detail
  113. });
  114. this.partialRenewal();
  115. },
  116. //局部数据更新 tabs
  117. partialRenewal(init = false) {
  118. let model = this.data.tabsList[this.data.tabsActive].model;
  119. if (model) {
  120. let Component = this.selectComponent(model),
  121. {
  122. total,
  123. pageNumber,
  124. pageTotal
  125. } = Component.data.content,
  126. id = this.data.detail.sa_logisticsid;
  127. // if (model == "#Binding") id = this.data.detail.sa_logistics_boxid;
  128. if (total == null || init) {
  129. Component.getList(id, init);
  130. } else if (pageNumber <= pageTotal) {
  131. Component.getList(id, false);
  132. }
  133. }
  134. },
  135. /* 确认收货 */
  136. receiving() {
  137. if (['HY', 'hy'].includes(wx.getStorageSync('userMsg').siteid)) {
  138. _Http.basic({
  139. "classname": "system.attachment.Attachment",
  140. "method": "queryFileLink",
  141. "content": {
  142. "nocache": true,
  143. "pageNumber": 1,
  144. "pageSize": 0,
  145. "ownertable": "sa_logistics",
  146. "ownerid": this.data.detail.sa_logisticsid
  147. }
  148. }).then(res => {
  149. console.log("附件", res)
  150. if (res.code != 1) return wx.showToast({
  151. title: res.msg,
  152. icon: "none"
  153. })
  154. if (res.total == 0) {
  155. wx.showModal({
  156. title: '提示',
  157. content: '当前单据未上传纸质回签单附件,不可确认收货',
  158. showCancel: false
  159. })
  160. } else {
  161. this.handleReceiving()
  162. }
  163. })
  164. } else {
  165. this.handleReceiving()
  166. }
  167. },
  168. handleReceiving() {
  169. let that = this;
  170. wx.showModal({
  171. cancelText: getApp().globalData.Language.getMapText('取消'),
  172. confirmText: getApp().globalData.Language.getMapText('确定'),
  173. title: getApp().globalData.Language.getMapText('提示'),
  174. content: getApp().globalData.Language.getMapText('是否确认收货?确认后不可更改'),
  175. complete: (res) => {
  176. if (res.confirm) _Http.basic({
  177. "id": "20221122133204",
  178. "content": {
  179. "sa_logisticsid": that.data.sa_logisticsid
  180. }
  181. }).then(s => {
  182. console.log("确认收货", s)
  183. if (s.code != '1') return wx.showToast({
  184. title: s.msg,
  185. icon: "none",
  186. mask: true
  187. });
  188. that.getDetail(true, false);
  189. setTimeout(() => {
  190. wx.showToast({
  191. title: getApp().globalData.Language.getMapText('确认收货成功'),
  192. icon: "none",
  193. mask: true
  194. });
  195. }, 500);
  196. })
  197. }
  198. })
  199. },
  200. onReachBottom() {
  201. this.partialRenewal();
  202. },
  203. onUnload() {
  204. let page = getCurrentPages().find(v => v.__route__ == 'packageA/shipment/index');
  205. let content = JSON.parse(JSON.stringify(page.data.content));
  206. content.pageNumber = 1;
  207. content.pageSize = (page.data.content.pageNumber - 1) * page.data.content.pageSize;
  208. _Http.basic({
  209. "id": wx.getStorageSync('userrole') == '业务员' ? 20221122132804 : 20230111141104,
  210. content
  211. }).then(res => {
  212. console.log("更新订单列表", res)
  213. if (res.code == '1') page.setData({
  214. list: res.data
  215. })
  216. })
  217. },
  218. })