orderDetailNewView.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <view class="orderDetailNewView">
  3. <view class="page-item" v-show="activeIndex === 0">
  4. <pageOne @handleNextClick="handleNextClick" :orderDetail="detail" :orderId="orderId"
  5. :currentReceipt="currentReceiptInner" />
  6. </view>
  7. <view class="page-item" v-show="activeIndex === 1">
  8. <pageTwo @handleNextClick="handleNextClick" :orderDetail="detail" :orderId="orderId"
  9. :currentReceipt="currentReceiptInner" :followUpList="followUpList" />
  10. </view>
  11. <view class="page-item" v-show="activeIndex === 2">
  12. <pageThree @handleNextClick="handleNextClick" :orderDetail="detail" @handleNeedSave="handleNeedSave"
  13. :currentReceipt="currentReceiptInner" @handleConfirmPay="handleConfirmPay" ref="pageThreeComp"
  14. :orderId="orderId" />
  15. </view>
  16. <view class="page-item" v-show="activeIndex === 3">
  17. <pageFour @confirmInterStore="confirmInterStore" @handleNextClick="handleNextClick" :orderDetail="detail"
  18. :currentReceipt="currentReceiptInner" />
  19. </view>
  20. <ul class="page">
  21. <li v-for="(tab, index) in tabs" :key="index" :class="{ 'active': activeIndex === index }">{{ tab }}</li>
  22. </ul>
  23. </view>
  24. </template>
  25. <script>
  26. import pageOne from './pageOne.vue'
  27. import pageTwo from './pageTwo.vue'
  28. import pageThree from './pageThree.vue'
  29. import pageFour from './pageFour.vue'
  30. export default {
  31. props: {
  32. detail: {
  33. type: Object,
  34. default: () => { },
  35. },
  36. topInfo: {
  37. type: Object,
  38. default: () => { },
  39. },
  40. orderId: {
  41. type: String,
  42. default: ''
  43. },
  44. currentReceipt: {
  45. type: Object,
  46. default: () => { },
  47. },
  48. },
  49. components: {
  50. pageOne,
  51. pageTwo,
  52. pageThree,
  53. pageFour
  54. },
  55. data() {
  56. return {
  57. activeIndex: 0,
  58. tabs: ['一', '二', '三', '四'],
  59. allFroms: {
  60. formOne: {},
  61. formTwo: {},
  62. formThree: {},
  63. formFour: {},
  64. },
  65. pageThreeForm: {},
  66. fileIds: '',
  67. //收件信息page4,page3
  68. receiptList: [],
  69. //订单细节
  70. orderDetail: {},
  71. // 跟进记录
  72. followUpList: [],
  73. //当前选中的收单订单
  74. currentReceiptInner: {},
  75. }
  76. },
  77. name: 'OrderDetailNewView',
  78. watch: {
  79. orderId: {
  80. handler(newVal) {
  81. if (newVal) {
  82. // this.fetchReceiptList();
  83. }
  84. }, immediate: true
  85. },
  86. detail: {
  87. handler(newVal) {
  88. if (newVal) {
  89. this.orderDetail = newVal;
  90. this.getFollowUpList();
  91. }
  92. },
  93. deep: true,
  94. },
  95. currentReceipt: {
  96. handler(newVal) {
  97. if (newVal) {
  98. this.currentReceiptInner = newVal;
  99. console.log('当前选中的收单订单里面', this.currentReceiptInner)
  100. }
  101. }
  102. }
  103. },
  104. methods: {
  105. handleNextClick({ nowPage, form }) {
  106. this.activeIndex++
  107. this.allFroms[nowPage] = form
  108. console.log("all page data:", this.allFroms[nowPage])
  109. // 当点击到第三页时,更新第三页的图片列表
  110. if (nowPage === 'formTwo') {
  111. this.$refs.pageThreeComp.getList('2', '3', this.currentReceiptInner.id);
  112. }
  113. },
  114. // 没有recepitid就新增
  115. async saveData(params) {
  116. await uni.$u.api.addReceiptForm(params);
  117. },
  118. // 有recepitid就更新
  119. async updateData(params) {
  120. await uni.$u.api.updateReceiptForm(params);
  121. },
  122. handleNeedSave({ nowPage, form, fileIds }) {
  123. this.pageThreeForm = form;
  124. this.fileIds = fileIds;
  125. const params = {
  126. "searchValue": this.detail.searchValue,
  127. "createBy": this.detail.createBy,
  128. "createTime": this.detail.createTime,
  129. "updateBy": this.detail.updateBy,
  130. "updateTime": this.detail.updateTime,
  131. // "remark": , //发单备注,先不传
  132. "params": this.detail.params, //看接口文档
  133. "id": this.currentReceiptInner.id,
  134. "sendFormId": this.orderId, //接单中心的id,就是接单中心列表的id(发单id)
  135. "clueId": this.detail.clueId,
  136. "item": this.detail.item,
  137. "brand": this.detail.brand,
  138. // "needCheckCode": 1, //先不传
  139. // "code": null, //先不传
  140. // "paymentAmount": null, //支付总额page3 先不传
  141. "phone": this.detail.phone,
  142. "tableFee": this.pageThreeForm.paymentAmount,//page3支付总额
  143. // "benefitFee": 200, //好处费page4加上
  144. // "freight": 30, //运费page4加上
  145. // "checkCodeFee": null, //查码费
  146. // "totalCost": "60230.00", // 成本合计 = 运费 + 好处费 + 查码费 + 表款(支付总额) + 维修费。
  147. "sellingPrice": this.topInfo.price, //实际价格(售价)顶上tab里面的第三栏
  148. // "performance": "29772.00", //sellingPrice - totalCost
  149. // "receiptRemark": //"收单之后还需再跟进", 先不传
  150. // "repairAmount": null, //维修总金额 ,先不传
  151. // "grossPerformance": "7443.00", //毛利 performance*splitRatio
  152. // "expressOrderNo": null, //快递单号+后续加上一个键加上图url
  153. "fileIds": this.fileIds, //传第三部里面排序完成之后的id的数组,参考编辑收单里面的附件传的方法
  154. "model": this.detail.model,
  155. // "splitRatio": "25", //分成比例,先不传
  156. "customerServiceName": "1", //默认传1,判断入库的类型,回收类入库,销售类入库,维保类入库,第四步传,增加选项下拉
  157. "deptId": this.detail.deptId,
  158. "category": this.detail.category,
  159. "delFlag": this.detail.delFlag,
  160. "idCard": this.pageThreeForm.idNumber,
  161. "paymentMethod": '小葫芦线上支付', //支付方式,如果是app里面默认传‘小葫芦线上支付’
  162. "bankCardNumber": this.pageThreeForm.bankAccount,
  163. "bankName": this.pageThreeForm.bankName,
  164. "customName": this.pageThreeForm.customName,
  165. }
  166. //调用接口保存收单表单
  167. if (this.detail.receiptId) {
  168. this.updateData(params);
  169. } else {
  170. this.saveData(params);
  171. }
  172. },
  173. // 确认支付
  174. handleConfirmPay() {
  175. // 调用支付接口
  176. this.pay();
  177. },
  178. //支付
  179. async pay() {
  180. // 开始支付
  181. console.log('开始支付')
  182. try {
  183. const response = await uni.$u.api.saveOrderFileAndTransfer({
  184. id: this.orderId,
  185. clueId: this.detail.clueId//线索id
  186. })
  187. uni.$u.toast(response.msg || '支付成功')
  188. } catch (error) {
  189. uni.$u.toast(`支付失败:${response.msg}`)
  190. }
  191. },
  192. //确认入库
  193. confirmInterStore({ warehouseInfo }) {
  194. console.log(warehouseInfo)
  195. const paramsInterStore = {
  196. "searchValue": this.detail.searchValue,
  197. "createBy": this.detail.createBy,
  198. "createTime": this.detail.createTime,
  199. "updateBy": this.detail.updateBy,
  200. "updateTime": this.detail.updateTime,
  201. // "remark": , //发单备注,先不传
  202. "params": this.detail.params, //看接口文档
  203. "id": this.currentReceiptInner.id,
  204. "sendFormId": this.orderId, //接单中心的id,就是接单中心列表的id(发单id)
  205. "clueId": this.detail.clueId,
  206. "item": warehouseInfo.item || '',
  207. "brand": this.detail.brand,
  208. // "needCheckCode": 1, //先不传
  209. "code": warehouseInfo.codeStorage || '', //先不传
  210. // "paymentAmount": null, //支付总额page3 先不传
  211. "phone": this.detail.phone,
  212. "tableFee": warehouseInfo.watchPrice || '',//page3支付总额
  213. "benefitFee": warehouseInfo.benefitFee || '', //好处费page4加上
  214. "freight": warehouseInfo.freight || '', //运费page4加上
  215. "checkCodeFee": warehouseInfo.checkCodeFee || '', //查码费
  216. // "totalCost": "60230.00", // 成本合计 = 运费 + 好处费 + 查码费 + 表款(支付总额) + 维修费。
  217. "sellingPrice": this.topInfo.price, //实际价格(售价)顶上tab里面的第三栏
  218. // "performance": "29772.00", //sellingPrice - totalCost
  219. "receiptRemark": warehouseInfo.remarks + ';' + warehouseInfo.uploadedImage || '',//"收单之后还需再跟进", 先不传
  220. "repairAmount": warehouseInfo.repairAmount || '', //维修总金额 ,先不传
  221. "grossPerformance": warehouseInfo.grossPerformance || '', //毛利 performance*splitRatio
  222. "expressOrderNo": warehouseInfo.expressOrderNo, //快递单号+后续加上一个键加上图url
  223. "fileIds": this.fileIds, //传第三部里面排序完成之后的id的数组,参考编辑收单里面的附件传的方法
  224. "model": this.detail.model,
  225. // "splitRatio": "25", //分成比例,先不传
  226. "customerServiceName": "1", //默认传1,判断入库的类型,回收类入库,销售类入库,维保类入库,第四步传,增加选项下拉
  227. "deptId": this.detail.deptId,
  228. "category": this.detail.category,
  229. "delFlag": this.detail.delFlag,
  230. "idCard": this.pageThreeForm.idNumber,
  231. "paymentMethod": '小葫芦线上支付', //支付方式,如果是app里面默认传‘小葫芦线上支付’
  232. "bankCardNumber": this.pageThreeForm.bankAccount,
  233. "bankName": this.pageThreeForm.bankName,
  234. "customName": this.pageThreeForm.customName,
  235. }
  236. //调用接口保存物流消息
  237. if (this.detail.receiptId) {
  238. this.updateData(paramsInterStore);
  239. } else {
  240. this.saveData(paramsInterStore);
  241. }
  242. },
  243. // 获取收单列表
  244. // async fetchReceiptList() {
  245. // try {
  246. // const res = await uni.$u.api.clueReceiptFormListByOrderId(this.orderId);
  247. // console.log('这里是收件列表', res.data)
  248. // this.receiptList = res.data || [];
  249. // } catch (error) {
  250. // console.error("获取收单列表失败:", error);
  251. // uni.$u.toast("获取收单列表失败");
  252. // }
  253. // },
  254. //获取跟进记录
  255. async getFollowUpList() {
  256. try {
  257. const res = await uni.$u.api.getDuplicateOrderFollowListByClueId({ clueId: this.orderDetail.clueId });
  258. const data = res.data || {};
  259. const followUpList = [];
  260. for (const key in data) {
  261. const element = data[key];
  262. followUpList.push(...element)
  263. }
  264. this.followUpList = followUpList;
  265. } catch (error) {
  266. console.error("获取跟进记录失败:", error);
  267. uni.$u.toast("获取跟进记录失败");
  268. }
  269. }
  270. },
  271. }
  272. </script>
  273. <style scoped>
  274. .orderDetailNewView {
  275. padding: 20rpx;
  276. }
  277. .page {
  278. position: fixed;
  279. right: 20rpx;
  280. top: 40%;
  281. display: flex;
  282. flex-direction: column;
  283. align-items: center;
  284. justify-content: center;
  285. list-style: none;
  286. color: #000;
  287. font-size: 20rpx;
  288. font-weight: 800;
  289. li {
  290. opacity: 0.7;
  291. display: flex;
  292. align-items: center;
  293. justify-content: center;
  294. background-color: #fff;
  295. border-radius: 50%;
  296. width: 70rpx;
  297. height: 70rpx;
  298. line-height: 80rpx;
  299. text-align: center;
  300. margin-bottom: 10rpx;
  301. transition: all 0.3s ease-in-out;
  302. font-weight: 800;
  303. }
  304. li.active {
  305. color: #fff;
  306. opacity: 1;
  307. background-color: rgb(37 99 235 / 1);
  308. }
  309. }
  310. </style>