普兆健康管家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

647 lines
16 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="订单详情" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />
  4. <view class="main">
  5. <view class="flex address" v-if="addressData">
  6. <addressView :data="addressData" :showIcon="true" :enableCopy="true"></addressView>
  7. </view>
  8. <template v-if="orderData">
  9. <view class="card detail">
  10. <view class="flex card-top">
  11. <view class="title">订单详情</view>
  12. <view :class="['flex', 'status', `status-${orderData.status}`]">{{ statusDesc }}</view>
  13. </view>
  14. <view class="card-main">
  15. <view class="flex product" v-for="item in orderData.productList" :key="item.id">
  16. <image class="img" :src="item.url" mode="scaleToFill"></image>
  17. <view class="info">
  18. <view class="row">{{ item.name }}</view>
  19. <view class="flex row">
  20. <view class="row-label">产品类型</view>
  21. <view class="row-content">{{ item.type }}</view>
  22. </view>
  23. <view class="flex row">
  24. <view class="row-label">产品内容</view>
  25. <view class="row-content">{{ item.content }}</view>
  26. </view>
  27. <view class="flex price">
  28. <text class="price-label">价格</text>
  29. <text class="price-unit">¥</text><text class="price-value">{{ item.price.toFixed(2) }}</text>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="flex row card-bottom">
  35. <view class="row-label">总价格</view>
  36. <view class="flex row-content price">¥<text class="price-value">{{ orderData.amount.toFixed(2) }}</text></view>
  37. </view>
  38. </view>
  39. <view v-if="orderData.status == 5" class="card service">
  40. <view class="flex card-top">
  41. <view class="title">售后信息</view>
  42. </view>
  43. <view class="card-main">
  44. <uv-steps
  45. current="0"
  46. direction="column"
  47. dot
  48. activeColor="#10A934"
  49. inactiveColor="#C6C6C6"
  50. >
  51. <uv-steps-item
  52. v-for="(item, index) in orderData.serviceRecords"
  53. :key="item.id"
  54. >
  55. <template #title>
  56. <view class="flex step-header">
  57. <view :class="['step-title', index == 0 ? 'highlight' : '']">{{ item.title }}</view>
  58. <view class="step-time">{{ item.createTime }}</view>
  59. </view>
  60. </template>
  61. <template #desc>
  62. <view class="step-desc">{{ item.desc }}</view>
  63. </template>
  64. </uv-steps-item>
  65. </uv-steps>
  66. </view>
  67. </view>
  68. <view class="card info">
  69. <view class="flex card-top">
  70. <view class="title">订单信息</view>
  71. </view>
  72. <view class="card-main">
  73. <view class="flex row">
  74. <view class="row-label">订单编号</view>
  75. <view class="row-content">{{ orderData.number }}</view>
  76. </view>
  77. <view class="flex row">
  78. <view class="row-label">下单时间</view>
  79. <view class="row-content">{{ $dayjs(orderData.createTime).format('YYYY-MM-DD HH:mm') }}</view>
  80. </view>
  81. </view>
  82. </view>
  83. </template>
  84. <view class="notice">
  85. <view class="notice-header">下单须知</view>
  86. <view class="notice-content">
  87. <!-- todo: 替换配置项key -->
  88. <uv-parse :content="configList['config_agreement']"></uv-parse>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="flex bottom" v-if="orderData && [0,1,2,3,4].includes(orderData.status)">
  93. <button plain class="flex flex-column btn btn-service" open-type="contact">
  94. <image class="btn-service-icon" src="@/pages_order/static/order/icon-service.png" mode="widthFix"></image>
  95. <view>联系客服</view>
  96. </button>
  97. <view class="flex cols">
  98. <!-- 待支付 -->
  99. <template v-if="orderData.status == 0">
  100. <view class="flex col price">
  101. <view class="price-label">合计</view>
  102. <text class="price-unit">¥</text><text class="price-value">{{ orderData.amount.toFixed(2) }}</text>
  103. </view>
  104. <button class="flex col btn btn-primary" @click="onPay">立即支付</button>
  105. </template>
  106. <!-- todo: check 体检套餐 检测预约 -->
  107. <!-- 待发货 -->
  108. <template v-else-if="orderData.status == 1">
  109. <button class="flex col btn" @click="onApplyService">申请售后</button>
  110. </template>
  111. <!-- 待收货 -->
  112. <template v-else-if="orderData.status == 2">
  113. <button class="flex col btn" @click="onApplyService">申请售后</button>
  114. <button class="flex col btn btn-primary" @click="onConfirmReceipt">确认收货</button>
  115. </template>
  116. <!-- 待评价 -->
  117. <template v-else-if="orderData.status == 3">
  118. <button class="flex col btn" @click="onApplyService">申请售后</button>
  119. <button class="flex col btn btn-primary" @click="onComment">立即评价</button>
  120. </template>
  121. <!-- 已完成 -->
  122. <template v-else-if="orderData.status == 4">
  123. <button class="flex col btn" @click="onApplyService">申请售后</button>
  124. </template>
  125. </view>
  126. </view>
  127. <payPopup ref="payPopup" @submitted="getData"></payPopup>
  128. <serviceSelectPopup ref="serviceSelectPopup"></serviceSelectPopup>
  129. </view>
  130. </template>
  131. <script>
  132. import addressView from '@/pages_order/address/addressView.vue'
  133. import payPopup from '@/pages_order/order/payPopup.vue'
  134. import serviceSelectPopup from '@/pages_order/applyService/serviceSelectPopup.vue'
  135. const STATUS_AND_DESC_MAPPING = {
  136. 0: '待支付',
  137. 1: '待发货',
  138. 2: '待收货',
  139. 3: '待评价',
  140. 4: '已完成',
  141. 5: '售后',
  142. }
  143. export default {
  144. components: {
  145. addressView,
  146. payPopup,
  147. serviceSelectPopup,
  148. },
  149. data() {
  150. return {
  151. id: null,
  152. addressData: null,
  153. orderData: null,
  154. }
  155. },
  156. computed: {
  157. statusDesc() {
  158. return STATUS_AND_DESC_MAPPING[this.orderData?.status]
  159. },
  160. },
  161. onShow() {
  162. console.log('onShow')
  163. if (!this.id) {
  164. return
  165. }
  166. this.getData()
  167. },
  168. onLoad(arg) {
  169. console.log('onLoad')
  170. this.id = arg.id
  171. this.getData()
  172. },
  173. methods: {
  174. async getData() {
  175. console.log('fetch data')
  176. // todo: fetch data by id
  177. this.addressData = {
  178. id: '001',
  179. name: '郑文锦',
  180. phone: '18108341643',
  181. area: ['海南省', '海口市', '秀英区'],
  182. address: '秀英街道5单元183室',
  183. // id: '006',
  184. // name: '何炜',
  185. // phone: '18108341643',
  186. // area: ['新疆维吾尔自治区', '乌鲁木齐市', '沙依巴克区'],
  187. // address: '新疆维吾尔自治区乌鲁木齐市沙依巴克区仓房沟片区街道4单元50室',
  188. }
  189. this.orderData = {
  190. id: '001',
  191. url: '/pages_order/static/index/recommend-pic.png',
  192. title: '月度装定制营养包',
  193. amount: 688,
  194. productList: [
  195. {
  196. id: '0011',
  197. url: '/pages_order/static/index/medicine-1.png',
  198. name: '月度装定制营养包',
  199. type: '保健品',
  200. content: '控糖精华萃 x30颗、膳食纤维 ×30颗',
  201. price: 688.00,
  202. count: 1,
  203. countDesc: '1月装',
  204. customized: true,
  205. },
  206. {
  207. id: '0012',
  208. url: '/pages_order/static/index/medicine-2.png',
  209. name: '月度装定制营养包',
  210. type: '保健品',
  211. content: '控糖精华萃 x30颗、膳食纤维 ×30颗',
  212. price: 688.00,
  213. count: 1,
  214. countDesc: '1月装',
  215. free: true,
  216. },
  217. {
  218. id: '0013',
  219. url: '/pages_order/static/index/medicine-3.png',
  220. name: '月度装定制营养包',
  221. type: '保健品',
  222. content: '控糖精华萃 x30颗、膳食纤维 ×30颗',
  223. price: 688.00,
  224. count: 1,
  225. countDesc: '1月装',
  226. free: true,
  227. },
  228. ],
  229. serviceRecords: [
  230. {
  231. id: '003',
  232. title: '退款成功',
  233. desc: '平台已为您退款,具体到账时间请查询支付账户',
  234. createTime: '2025-04-20 12:00',
  235. },
  236. {
  237. id: '002',
  238. title: '等待审核',
  239. desc: '您的服务单已申请成功,待售后审核',
  240. createTime: '2025-04-20 12:00',
  241. },
  242. {
  243. id: '001',
  244. title: '提交申请',
  245. desc: '包装破损',
  246. createTime: '2025-04-20 12:00',
  247. },
  248. ],
  249. userName: '周小艺',
  250. phone: '15558661691',
  251. number: 'BH872381728321983929',
  252. createTime: '2025-04-28 08:14',
  253. status: 5,
  254. }
  255. console.log('addressData', this.addressData)
  256. console.log('orderData', this.orderData)
  257. },
  258. onPay() {
  259. const {
  260. id,
  261. title,
  262. amount
  263. } = this.orderData
  264. const obj = {
  265. title,
  266. orderId: id,
  267. amount,
  268. }
  269. this.$refs.payPopup.open(obj)
  270. },
  271. onConfirmReceipt() {
  272. // todo: fetch confirm
  273. this.getData()
  274. },
  275. onComment() {
  276. this.$utils.navigateTo(`/pages_order/comment/commentWrite?id=${this.orderData.id}`)
  277. },
  278. onApplyService() {
  279. const {
  280. id,
  281. productList,
  282. } = this.orderData
  283. const obj = {
  284. id,
  285. productList,
  286. }
  287. this.$refs.serviceSelectPopup.open(obj)
  288. },
  289. },
  290. }
  291. </script>
  292. <style scoped lang="scss">
  293. .page__view {
  294. width: 100vw;
  295. min-height: 100vh;
  296. background-color: $uni-bg-color;
  297. position: relative;
  298. /deep/ .nav-bar__view {
  299. position: fixed;
  300. top: 0;
  301. left: 0;
  302. }
  303. }
  304. .main {
  305. padding: calc(var(--status-bar-height) + 144rpx) 32rpx 224rpx 32rpx;
  306. }
  307. .address {
  308. padding: 24rpx 32rpx;
  309. background: #FFFFFF;
  310. border-radius: 24rpx;
  311. justify-content: flex-start;
  312. }
  313. .card {
  314. margin-top: 40rpx;
  315. padding: 32rpx;
  316. background: #FAFAFF;
  317. border: 2rpx solid #FFFFFF;
  318. border-radius: 32rpx;
  319. &-top {
  320. margin-bottom: 32rpx;
  321. justify-content: space-between;
  322. .title {
  323. font-family: PingFang SC;
  324. font-weight: 500;
  325. font-size: 36rpx;
  326. line-height: 1.4;
  327. color: #252545;
  328. }
  329. .status {
  330. display: inline-flex;
  331. min-width: 120rpx;
  332. padding: 6rpx 0;
  333. box-sizing: border-box;
  334. font-family: PingFang SC;
  335. font-weight: 400;
  336. font-size: 24rpx;
  337. line-height: 1.4;
  338. color: #252545;
  339. background: #F3F3F3;
  340. border-radius: 12rpx;
  341. &-0 {
  342. color: #FF860E;
  343. background: #FFF4E9;
  344. }
  345. &-1 {
  346. color: #2799E0;
  347. background: #EEF7FD;
  348. }
  349. &-2 {
  350. color: #7D27E0;
  351. background: #F5EEFD;
  352. }
  353. &-5 {
  354. color: #E53C29;
  355. background: #FDE7E5;
  356. }
  357. }
  358. }
  359. .row {
  360. justify-content: space-between;
  361. font-family: PingFang SC;
  362. font-weight: 400;
  363. font-size: 28rpx;
  364. line-height: 1.4;
  365. &-label {
  366. flex: none;
  367. color: #8B8B8B;
  368. }
  369. &-content {
  370. color: #393939;
  371. }
  372. }
  373. &.detail {
  374. .product {
  375. margin-bottom: 32rpx;
  376. column-gap: 24rpx;
  377. .img {
  378. flex: none;
  379. width: 120rpx;
  380. height: 120rpx;
  381. }
  382. .info {
  383. flex: 1;
  384. padding: 24rpx 32rpx;
  385. background: #FFFFFF;
  386. border-radius: 32rpx;
  387. .row {
  388. margin-bottom: 16rpx;
  389. justify-content: flex-start;
  390. column-gap: 4rpx;
  391. }
  392. .price {
  393. justify-content: flex-start;
  394. column-gap: 8rpx;
  395. font-family: PingFang SC;
  396. font-weight: 500;
  397. line-height: 1.4;
  398. &-label {
  399. font-weight: 400;
  400. font-size: 26rpx;
  401. color: #8B8B8B;
  402. }
  403. &-unit {
  404. font-size: 24rpx;
  405. color: #7451DE;
  406. }
  407. &-value {
  408. font-size: 32rpx;
  409. color: #7451DE;
  410. }
  411. }
  412. }
  413. }
  414. .card-bottom {
  415. .price {
  416. column-gap: 8rpx;
  417. font-family: PingFang SC;
  418. font-weight: 500;
  419. font-size: 24rpx;
  420. line-height: 1.4;
  421. color: #7451DE;
  422. &-value {
  423. font-size: 32rpx;
  424. }
  425. }
  426. }
  427. }
  428. &.info {
  429. .row + .row {
  430. margin-top: 32rpx;
  431. }
  432. }
  433. &.service {
  434. .step {
  435. &-header {
  436. justify-content: flex-start;
  437. column-gap: 24rpx;
  438. padding-left: 24rpx;
  439. }
  440. &-title {
  441. font-family: PingFang SC;
  442. font-weight: 400;
  443. font-size: 30rpx;
  444. line-height: 1.4;
  445. color: #000000;
  446. &.highlight {
  447. font-weight: 500;
  448. color: #10A934;
  449. }
  450. }
  451. &-time {
  452. font-family: PingFang SC;
  453. font-weight: 400;
  454. font-size: 24rpx;
  455. line-height: 1.4;
  456. color: #8B8B8B;
  457. }
  458. &-desc {
  459. padding: 16rpx 0 16rpx 24rpx;
  460. font-family: PingFang SC;
  461. font-weight: 400;
  462. font-size: 24rpx;
  463. line-height: 1.4;
  464. color: #777777;
  465. }
  466. }
  467. }
  468. }
  469. .notice {
  470. margin-top: 40rpx;
  471. font-family: PingFang SC;
  472. font-weight: 400;
  473. &-header {
  474. font-size: 28rpx;
  475. line-height: 1.4;
  476. color: #393939;
  477. }
  478. &-content {
  479. margin-top: 24rpx;
  480. font-size: 24rpx;
  481. line-height: 1.4;
  482. color: #BABABA;
  483. }
  484. }
  485. .bottom {
  486. position: fixed;
  487. left: 0;
  488. bottom: 0;
  489. z-index: 2;
  490. column-gap: 32rpx;
  491. width: 100vw;
  492. height: 200rpx;
  493. padding: 24rpx 40rpx;
  494. background: #FFFFFF;
  495. box-sizing: border-box;
  496. .btn {
  497. background: transparent;
  498. border: none;
  499. &-service {
  500. flex: none;
  501. row-gap: 4rpx;
  502. font-family: PingFang SC;
  503. font-weight: 400;
  504. font-size: 22rpx;
  505. line-height: 1.1;
  506. color: #999999;
  507. &-icon {
  508. width: 52rpx;
  509. height: auto;
  510. }
  511. }
  512. }
  513. .cols {
  514. flex: 1;
  515. column-gap: 32rpx;
  516. .col {
  517. flex: 1;
  518. }
  519. .btn {
  520. padding: 14rpx 0;
  521. box-sizing: border-box;
  522. font-family: PingFang SC;
  523. font-weight: 500;
  524. font-size: 36rpx;
  525. line-height: 1.4;
  526. color: #252545;
  527. border: 2rpx solid #252545;
  528. border-radius: 41rpx;
  529. &-primary {
  530. padding: 16rpx 0;
  531. color: #FFFFFF;
  532. background-image: linear-gradient(to right, #4B348F, #845CFA);
  533. border: none;
  534. }
  535. }
  536. .price {
  537. column-gap: 8rpx;
  538. font-family: PingFang SC;
  539. font-weight: 400;
  540. font-size: 24rpx;
  541. line-height: 1.4;
  542. &-label {
  543. color: #626262;
  544. }
  545. &-unit,
  546. &-value {
  547. font-weight: 500;
  548. color: #7451DE;
  549. .highlight {
  550. font-size: 40rpx;
  551. }
  552. }
  553. &-value {
  554. font-size: 40rpx;
  555. }
  556. }
  557. }
  558. }
  559. </style>