orderDetailNewView.vue 7.5 KB

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