orderDetail.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <view class="order-detail">
  3. <view class="hui-detail">
  4. <view class="detail-box">
  5. <view class="title-box">
  6. <view class="title">{{orderData.title||'-'}}</view>
  7. <view class="date">{{orderData.createTime || '-'}}</view>
  8. <view class="title-icon">
  9. <uni-icons type="icon-hetongwendang" custom-prefix="iconfont" color="#fff" size="18">
  10. </uni-icons>
  11. </view>
  12. </view>
  13. <view class="other">
  14. <view class="item">
  15. <view class="label">订单编号</view>
  16. <view class="value"> {{orderData.orderNo ||'-'}}</view>
  17. </view>
  18. <view class="item">
  19. <view class="label">价格(元)</view>
  20. <view class="value color-error">{{orderData.totalFee || '-'}}</view>
  21. </view>
  22. </view>
  23. <view class="state">
  24. <view></view>
  25. <view class="tag">
  26. <view class="status-tag" :class="{
  27. 'warning':orderData.orderStatus === '未支付',
  28. 'success':orderData.orderStatus === '支付成功',
  29. 'error':orderData.orderStatus === '超时已关闭'
  30. }">
  31. {{orderData.orderStatus}}
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="detail-box" v-if="!orderData.proceId">
  37. <view class="sub-title file-box">
  38. <uni-icons type="map-filled" class="inherit-icons" size="24" color="#08979c"></uni-icons>
  39. <text class="sub-label">订单合同</text>
  40. </view>
  41. <view class="other">
  42. <view class="item" v-if="orderData.contractId">
  43. <view class="label">合同编号</view>
  44. <view class="value">{{contractNode.contractNo}}</view>
  45. </view>
  46. <view class="item" v-if="orderData.contractId">
  47. <view class="label">合同内容</view>
  48. <view class="value">
  49. <text class="color-primary">查看合同</text>
  50. </view>
  51. </view>
  52. <view class="item">
  53. <view class="label">合同状态</view>
  54. <view class="value">
  55. <uv-steps :current="current" direction="column" dot>
  56. <uv-steps-item title="服务商上传合同" :desc="contractNode.createDate"></uv-steps-item>
  57. <uv-steps-item title="客户确认" :desc="contractNode.confirmDate"></uv-steps-item>
  58. <uv-steps-item title="服务商盖章" :desc="contractNode.processDate"></uv-steps-item>
  59. <uv-steps-item title="客户盖章" :desc="contractNode.updateDate"></uv-steps-item>
  60. <uv-steps-item title="签约成功" :desc="contractNode.updateDate"></uv-steps-item>
  61. </uv-steps>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="detail-box">
  67. <view class="sub-title file-box">
  68. <uni-icons type="map-filled" class="inherit-icons" size="24" color="#08979c"></uni-icons>
  69. <text class="sub-label">订单过程</text>
  70. </view>
  71. <view class="other process-box">
  72. <process-item :list="contractProcessList"></process-item>
  73. </view>
  74. </view>
  75. </view>
  76. <view class="hui-button-box" v-if="operationBtn.length>0">
  77. <view class="hui-button" v-for="(item,index) in operationBtn" :key="index" @click="operation(item)">
  78. {{item.name}}
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import {
  85. getOrderDetail,
  86. getBindContract,
  87. getProcessData,
  88. getWxPay
  89. } from '@/request/api/workark.js'
  90. import processItem from '@/subPages/indexPage/components/processItem.vue';
  91. export default {
  92. components: {
  93. processItem
  94. },
  95. data() {
  96. return {
  97. orderId: '',
  98. orderData: {},
  99. operationBtn: [],
  100. contractNode: {},
  101. current: 0,
  102. contractProcessList: []
  103. };
  104. },
  105. onLoad(body) {
  106. this.orderId = body.orderId;
  107. if (this.orderId) this.init();
  108. },
  109. methods: {
  110. async init() {
  111. let orderData = await getOrderDetail(this.orderId);
  112. if (!orderData.state) return;
  113. this.orderData = orderData.data;
  114. this.current = this.returnCurrent();
  115. this.initProcessData();
  116. if (this.orderData.contractId) this.initBindContract();
  117. },
  118. async initBindContract() {
  119. let contractNode = await getBindContract(this.orderData.contractId);
  120. if (!contractNode.state) return;
  121. this.contractNode = contractNode.data;
  122. },
  123. async initProcessData() {
  124. let contractProcess = await getProcessData(this.orderData.id);
  125. if (!contractProcess.state) return;
  126. this.contractProcessList = contractProcess.data;
  127. this.updateParentStatus(this.contractProcessList);
  128. },
  129. returnCurrent() {
  130. if (!this.orderData.contractId) return 0;
  131. if (this.orderData.contractStatus === 0) return 1;
  132. if (this.orderData.contractStatus === 1) return 2;
  133. if (this.orderData.contractStatus === 2) return 3;
  134. if (this.orderData.contractStatus === 3) return 5;
  135. },
  136. updateParentStatus(nodes) {
  137. nodes.forEach(node => {
  138. if (node.type !== 3) {
  139. // 递归处理子节点
  140. let children = !node.children ? [] : node.children.filter(item => item.type != 3);
  141. if (children.length > 0) {
  142. this.updateParentStatus(node.children); // 先处理子节点
  143. // 获取所有子节点的 status
  144. const childStatusList = node.children.map(child => child.status);
  145. // 判断条件优先级:4 > 1/2 > 3
  146. if (childStatusList.some(status => status === 4)) {
  147. node.status = 4;
  148. } else if (childStatusList.some(status => status === 1 || status === 2)) {
  149. node.status = 1;
  150. } else if (childStatusList.every(status => status === 3)) {
  151. node.status = 3;
  152. } else if (childStatusList.some(status => status === 3)) {
  153. node.status = 1;
  154. }
  155. }
  156. }
  157. });
  158. }
  159. }
  160. }
  161. </script>
  162. <style lang="scss" scoped>
  163. //详情
  164. .hui-detail {
  165. padding: 30rpx;
  166. .detail-box {
  167. background-color: #ffffff;
  168. border-radius: 16rpx;
  169. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  170. padding: 30rpx;
  171. position: relative;
  172. margin-bottom: 30rpx;
  173. &.file-box {
  174. padding-bottom: 20rpx;
  175. }
  176. }
  177. .sub-title {
  178. display: flex;
  179. align-items: center;
  180. margin-left: -8rpx;
  181. .sub-label {
  182. font-size: 32rpx;
  183. font-weight: 600;
  184. margin-left: 14rpx;
  185. }
  186. }
  187. .title-box {
  188. padding-left: 90rpx;
  189. position: relative;
  190. min-height: 88rpx;
  191. .title-icon {
  192. width: 70rpx;
  193. height: 70rpx;
  194. text-align: center;
  195. line-height: 70rpx;
  196. background: $uv-primary;
  197. border-radius: 70rpx;
  198. position: absolute;
  199. left: 0;
  200. top: 50%;
  201. margin-top: -35rpx;
  202. }
  203. .title {
  204. font-size: 32rpx;
  205. font-weight: 600;
  206. margin-bottom: 8rpx;
  207. }
  208. .date {
  209. font-size: 24rpx;
  210. color: $uv-content-color;
  211. }
  212. }
  213. .other {
  214. margin-top: 20rpx;
  215. .item {
  216. margin-top: 16rpx;
  217. }
  218. .label {
  219. color: $uv-content-color;
  220. font-size: 24rpx;
  221. }
  222. .value {
  223. margin-top: 10rpx;
  224. font-weight: 400;
  225. }
  226. .file-item {
  227. background-color: #ededed;
  228. height: 80rpx;
  229. display: flex;
  230. align-items: center;
  231. border-radius: 12rpx;
  232. padding: 0 14rpx;
  233. }
  234. .file-name {
  235. flex: 1;
  236. width: 0;
  237. margin-left: 10rpx;
  238. }
  239. .contarct-item {
  240. background-color: #ededed;
  241. border-radius: 12rpx;
  242. padding: 20rpx;
  243. margin-bottom: 20rpx;
  244. }
  245. .contarct-content {
  246. display: flex;
  247. justify-content: space-between;
  248. align-items: center;
  249. margin-bottom: 16rpx;
  250. &.last {
  251. margin-bottom: 0rpx;
  252. .content-item {
  253. flex: 1;
  254. width: 0;
  255. }
  256. }
  257. .content-title {
  258. font-size: 32rpx;
  259. font-weight: 500;
  260. }
  261. .content-label {
  262. color: $uv-content-color;
  263. font-size: 24rpx;
  264. }
  265. .content-value {
  266. font-weight: 400;
  267. margin-left: 6rpx;
  268. flex: 1;
  269. width: 0;
  270. }
  271. .content-item {
  272. overflow: hidden;
  273. display: flex;
  274. align-items: center;
  275. &.content-title {
  276. flex: 1;
  277. width: 0;
  278. }
  279. }
  280. }
  281. }
  282. .state {
  283. margin-top: 20rpx;
  284. display: flex;
  285. justify-content: space-between;
  286. .create {
  287. height: 48rpx;
  288. border-radius: 48rpx;
  289. border: 1px solid $uv-primary;
  290. display: flex;
  291. align-items: center;
  292. color: $uv-primary;
  293. padding: 0 10rpx;
  294. .name {
  295. font-size: 24rpx;
  296. flex: 1;
  297. max-width: 150rpx;
  298. min-width: 70rpx;
  299. overflow: hidden;
  300. margin-left: 10rpx;
  301. line-height: 36rpx;
  302. padding-right: 10rpx;
  303. }
  304. }
  305. }
  306. }
  307. </style>