orderDetailNewView.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view class="orderDetailNewView">
  3. <view class="page-item" v-show="activeIndex === 0">
  4. <pageOne @handleNextClick="handleNextClick" :orderDetail="detail" :orderId="orderId" />
  5. </view>
  6. <view class="page-item" v-show="activeIndex === 1">
  7. <pageTwo @handleNextClick="handleNextClick" :orderDetail="detail" />
  8. </view>
  9. <view class="page-item" v-show="activeIndex === 2">
  10. <pageThree @handleNextClick="handleNextClick" :detailImages="allFroms.formTwo.detailImages || []"
  11. :orderDetail="detail" @handleNeedSave="handleNeedSave" />
  12. </view>
  13. <view class="page-item" v-show="activeIndex === 3">
  14. <pageFour @handleNextClick="handleNextClick" :orderDetail="detail" />
  15. </view>
  16. <ul class="page">
  17. <li v-for="(tab, index) in tabs" :key="index" :class="{ 'active': activeIndex === index }"
  18. @click="activeIndex = index">{{ tab }}</li>
  19. </ul>
  20. </view>
  21. </template>
  22. <script>
  23. import pageOne from './pageOne.vue'
  24. import pageTwo from './pageTwo.vue'
  25. import pageThree from './pageThree.vue'
  26. import pageFour from './pageFour.vue'
  27. export default {
  28. props: {
  29. detail: {
  30. type: Object,
  31. default: () => { },
  32. },
  33. topInfo: {
  34. type: Object,
  35. default: () => { },
  36. },
  37. orderId: {
  38. type: String,
  39. default: ''
  40. }
  41. },
  42. components: {
  43. pageOne,
  44. pageTwo,
  45. pageThree,
  46. pageFour
  47. },
  48. data() {
  49. return {
  50. activeIndex: 0,
  51. tabs: ['一', '二', '三', '四'],
  52. allFroms: {
  53. formOne: {},
  54. formTwo: {},
  55. formThree: {},
  56. formFour: {},
  57. },
  58. pageThreeForm: {}
  59. }
  60. },
  61. name: 'OrderDetailNewView',
  62. methods: {
  63. handleNextClick({ nowPage, form }) {
  64. this.activeIndex++
  65. this.allFroms[nowPage] = form
  66. console.log("all page data:", this.allFroms[nowPage])
  67. },
  68. // 支付前保存数据
  69. async saveData() {
  70. await uni.$u.api.addReceiptForm({
  71. "searchValue": this.detail.searchValue,
  72. "createBy": this.detail.createBy,
  73. "createTime": this.detail.createTime,
  74. "updateBy": this.detail.updateBy,
  75. "updateTime": this.detail.updateTime,
  76. // "remark": , //发单备注,先不传
  77. "params": this.detail.params, //看接口文档
  78. "id": this.detail.receiptId,
  79. "sendFormId": this.orderId, //接单中心的id,就是接单中心列表的id(发单id)
  80. "clueId": this.detail.clueId,
  81. "item": this.detail.item,
  82. "brand": this.detail.brand,
  83. // "needCheckCode": 1, //先不传
  84. // "code": null, //先不传
  85. // "paymentAmount": null, //支付总额page3 先不传
  86. "phone": this.detail.phone,
  87. "tableFee": this.pageThreeForm.paymentAmount,//page3支付总额
  88. // "benefitFee": 200, //好处费page4加上
  89. // "freight": 30, //运费page4加上
  90. // "checkCodeFee": null, //查码费
  91. // "totalCost": "60230.00", // 成本合计 = 运费 + 好处费 + 查码费 + 表款(支付总额) + 维修费。
  92. "sellingPrice": this.topInfo.price.replace(/,/g, ''), //实际价格(售价)顶上tab里面的第三栏
  93. // "performance": "29772.00", //sellingPrice - totalCost
  94. // "receiptRemark": //"收单之后还需再跟进", 先不传
  95. // "repairAmount": null, //维修总金额 ,先不传
  96. // "grossPerformance": "7443.00", //毛利 performance*splitRatio
  97. // "expressOrderNo": null, //快递单号+后续加上一个键加上图url
  98. // "fileIds": "", //传第三部里面排序完成之后的id的数组,参考编辑收单里面的附件传的方法
  99. "model": this.detail.model,
  100. // "splitRatio": "25", //分成比例,先不传
  101. "customerServiceName": "1", //默认传1,判断入库的类型,回收类入库,销售类入库,维保类入库,第四步传,增加选项下拉
  102. "deptId": this.detail.deptId,
  103. "category": this.detail.category,
  104. "delFlag": this.detail.delFlag,
  105. "idCard": this.pageThreeForm.idNumber,
  106. "paymentMethod": '小葫芦线上支付', //支付方式,如果是app里面默认传‘小葫芦线上支付’
  107. "bankCardNumber": this.pageThreeForm.bankAccount,
  108. "bankName": this.pageThreeForm.bankName,
  109. "customName": this.pageThreeForm.customName,
  110. });
  111. },
  112. // 保存实物图数据
  113. saveDetailImagesData() {
  114. // 上传二进制文件
  115. // console.log("上传文件成功:1", this.allFroms.formOne.truePic)
  116. // this.allFroms.formOne.truePic.forEach(async (item) => {
  117. // const res = await uni.$u.api.uploadFile(item);
  118. // console.log("上传文件成功:", res)
  119. // })
  120. },
  121. // // 保存聊天图数据
  122. // saveChatPicData() {
  123. // this.allFroms.formOne.truePic.forEach(async (item) => {
  124. // await uni.$u.api.uploadFile(item);
  125. // })
  126. // },
  127. // // 保存高清图数据
  128. // saveHighDefinitionPicData() {
  129. // this.allFroms.formOne.truePic.forEach(async (item) => {
  130. // await uni.$u.api.uploadFile(item);
  131. // })
  132. // },
  133. handleNeedSave({ nowPage, form }) {
  134. this.pageThreeForm = form;
  135. //调用接口保存收单表单
  136. this.saveData();
  137. // this.saveDetailImagesData();
  138. //保存数据之后调支付接口
  139. this.pay();
  140. },
  141. //支付
  142. async pay() {
  143. // 开始支付
  144. console.log('开始支付')
  145. try {
  146. const response = await uni.$u.api.saveOrderFileAndTransfer({
  147. id: this.orderId,
  148. clueId: this.detail.clueId//线索id
  149. })
  150. uni.$u.toast(response.msg || '支付成功')
  151. } catch (error) {
  152. uni.$u.toast(`支付失败:${response.msg}`)
  153. }
  154. }
  155. }
  156. }
  157. </script>
  158. <style scoped>
  159. .orderDetailNewView {
  160. padding: 20rpx;
  161. }
  162. .page {
  163. position: fixed;
  164. right: 20rpx;
  165. top: 40%;
  166. display: flex;
  167. flex-direction: column;
  168. align-items: center;
  169. justify-content: center;
  170. list-style: none;
  171. color: #000;
  172. font-size: 20rpx;
  173. font-weight: 800;
  174. li {
  175. opacity: 0.7;
  176. display: flex;
  177. align-items: center;
  178. justify-content: center;
  179. background-color: #fff;
  180. border-radius: 50%;
  181. width: 70rpx;
  182. height: 70rpx;
  183. line-height: 80rpx;
  184. text-align: center;
  185. margin-bottom: 10rpx;
  186. transition: all 0.3s ease-in-out;
  187. font-weight: 800;
  188. }
  189. li.active {
  190. color: #fff;
  191. opacity: 1;
  192. background-color: rgb(37 99 235 / 1);
  193. }
  194. }
  195. </style>