orderDetail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. <template>
  2. <view class="order-detail-page">
  3. <!-- 顶部导航栏 -->
  4. <view class="custom-navbar">
  5. <view class="navbar-left">
  6. <text class="fa fa-angle-left" @click="goBack"></text>
  7. </view>
  8. <view class="navbar-right scale-tap" @click="goPages('/pages/crowdFunding/customerService')">
  9. <image src="@/static/crowdFunding/customer-service-btn.png" style="width: 60rpx; height: 60rpx" mode="widthFix">
  10. </image>
  11. </view>
  12. </view>
  13. <!-- status:0待支付,1已支付,2已发货/待收货,3已收货,5已完成,6退款中,8关闭(取消或退款后),9已完成 -->
  14. <!-- 状态栏 -->
  15. <view class="status-bar">
  16. <!-- <image v-if="statusIcon" :src="statusIcon" class="status-icon"/> -->
  17. <!-- 失败 -->
  18. <image v-if="status == 8" :src="'../../static/crowdFunding/fail.png'" class="status-icon" />
  19. <!-- 成功 -->
  20. <image v-else-if="status == 5 || status == 3 || status == 9" :src="'../../static/crowdFunding/success.png'" class="status-icon" />
  21. <!-- 进行中 -->
  22. <image v-else-if="status == 2 || status == 6" :src="'../../static/crowdFunding/loading.png'" class="status-icon" />
  23. <text class="status-title">{{ statusTitle }}</text>
  24. </view>
  25. <!-- 收货信息 -->
  26. <view class="address-card scale-tap" @click="goPages('/pages/crowdFunding/receivingAddress')">
  27. <view class="row">
  28. <text class="name">{{ address.realname }}</text>
  29. <text class="mobile">{{ address.mobile }}</text>
  30. <text class="default" v-if="address.is_default == 'yse'">默认</text>
  31. </view>
  32. <view class="address">收获地址:{{ address.area + address.address }}</view>
  33. </view>
  34. <!-- 商品卡片 -->
  35. <view class="product-card">
  36. <view class="product-top" @click="goPages('/pages/crowdFunding/crowdfundingDetails?id=' + product.id)">
  37. <image class="product-img" :src="product.img" />
  38. <view class="product-info">
  39. <view class="product-title"><text class="two-omit">{{ product.title }} </text>
  40. <image class="arrow" mode="widthFix" src="@/static/crowdFunding/right.png" />
  41. </view>
  42. <view class="product-desc">
  43. {{ product.desc }}
  44. </view>
  45. </view>
  46. </view>
  47. <view class="product-bom">
  48. <view class="product-spec">回报档:¥{{ product.price }} {{ product.spec }}
  49. <text class="count">x{{ product.count }}</text>
  50. </view>
  51. <view class="product-time">
  52. 预计发货时间:{{ product.deliveryTime }}
  53. </view>
  54. <!-- <view class="product-tip">{{ product.tip }}</view> -->
  55. </view>
  56. <!-- 费用明细 -->
  57. <!-- <view class="fee-row">
  58. <text>运费</text>
  59. <text>包邮</text>
  60. </view> -->
  61. <view class="fee-row total">
  62. <text>总金额</text>
  63. <text class="total-price">¥{{ product.total }}</text>
  64. </view>
  65. </view>
  66. <!-- 订单信息 -->
  67. <view class="order-info-card">
  68. <view class="info-row" v-if="order.orderNo">
  69. <text>订单编号</text>
  70. <view><text>{{ order.orderNo }}</text>
  71. <text class="copy-btn" @click="copy(order.orderNo)">复制</text>
  72. </view>
  73. </view>
  74. <view class="info-row" v-if="order.createTime">
  75. <text>下单时间</text>
  76. <text>{{ order.createTime }}</text>
  77. </view>
  78. <view class="info-row" v-if="order.payTime">
  79. <text>付款时间</text>
  80. <text>{{ order.payTime }}</text>
  81. </view>
  82. </view>
  83. <!-- 底部操作栏 -->
  84. <view class="order-bottom">
  85. <template v-if="status == 0">
  86. <view class="btn scale-tap btn-cancel" @click="cancelOrder">取消订单</view>
  87. <view class="btn scale-tap btn-pay" @click="payOrder">立即支付</view>
  88. </template>
  89. <template v-else-if="status == 1">
  90. <view class="btn scale-tap btn-refund" @click="refundOrder">申请退款</view>
  91. </template>
  92. <template v-else-if="status == 2">
  93. <view class="btn scale-tap btn-pay" @click="confirmOrder">确认收货</view>
  94. <!-- <view class="btn scale-tap btn-comment" @click="commentOrder">去评价</view> -->
  95. </template>
  96. <template v-else-if="status == 3 || status == 5 || status == 9">
  97. <view class="btn scale-tap btn-delete" @click="deleteOrder">删除订单</view>
  98. <!-- <view class="btn scale-tap btn-comment" @click="commentOrder">去评价</view> -->
  99. </template>
  100. <template v-else-if="status == 6">
  101. <view class="btn btn-delete " style="background: #eee;">退款中</view>
  102. <!-- <view class="btn scale-tap btn-comment" @click="commentOrder">去评价</view> -->
  103. </template>
  104. <template v-else-if="status == 8">
  105. <!-- <view class="btn btn-delete" style="background: #eee;">已关闭</view> -->
  106. <view class="btn scale-tap btn-delete" @click="deleteOrder">删除订单</view>
  107. <!-- <view class="btn scale-tap btn-comment" @click="commentOrder">去评价</view> -->
  108. </template>
  109. <template v-else>
  110. <!-- <view class="btn scale-tap btn-delete" @click="deleteOrder">删除订单</view> -->
  111. </template>
  112. </view>
  113. <!-- 支付方式选择弹窗 -->
  114. <uni-popup ref="paymentPopup" type="bottom">
  115. <view class="payment-popup">
  116. <view class="popup-header">
  117. <view class="popup-title">选择支付方式</view>
  118. </view>
  119. <view class="payment-options">
  120. <view class="payment-option" @tap="selectPayment('alipay')">
  121. <image class="payment-icon" src="../../static/icon/pay_ali.png" mode="aspectFit"></image>
  122. <view class="payment-name">支付宝支付</view>
  123. <image class="payment-select"
  124. :src="paymentMethod === 'alipay' ? '../../static/icon/wd_icon_gouxuan05.png' : '../../static/icon/wd_icon_gouxuan04.png'"
  125. mode="aspectFit"></image>
  126. </view>
  127. <view v-if="isWeChatPay" class="payment-option" @tap="selectPayment('wechat')">
  128. <image class="payment-icon" src="../../static/icon/pay_wx.png" mode="aspectFit"></image>
  129. <view class="payment-name">微信支付</view>
  130. <image class="payment-select"
  131. :src="paymentMethod === 'wechat' ? '../../static/icon/wd_icon_gouxuan05.png' : '../../static/icon/wd_icon_gouxuan04.png'"
  132. mode="aspectFit"></image>
  133. </view>
  134. </view>
  135. <view class="confirm-payment" @tap="confirmPayment">立即支付</view>
  136. </view>
  137. </uni-popup>
  138. <!-- 提示框 -->
  139. <DialogBox ref="DialogBox"></DialogBox>
  140. </view>
  141. </template>
  142. <script>
  143. export default {
  144. data() {
  145. return {
  146. statusType: "waitPay", // waitPay, waitSend, finish, waitComment, fail
  147. status: "",
  148. statusTitle: "", // 根据statusType动态切换
  149. statusIcon: "loading", // 可根据状态切换icon loading fail success
  150. address: {},
  151. product: {},
  152. order: {},
  153. paymentMethod: 'alipay', // 默认支付宝支付
  154. isWeChatPay: true, // 是否显示微信支付选项
  155. orderId: "",
  156. };
  157. },
  158. onLoad(options) {
  159. this.getOrderDetail(options.orderId);
  160. this.orderId = options.orderId;
  161. },
  162. methods: {
  163. goBack() {
  164. uni.navigateBack();
  165. },
  166. goPages(url) {
  167. uni.navigateTo({ url });
  168. },
  169. copy(val) {
  170. uni.setClipboardData({ data: val });
  171. },
  172. cancelOrder() {
  173. this.$refs["DialogBox"].confirm({
  174. title: "提示",
  175. content: "确定要取消订单吗?",
  176. DialogType: "inquiry",
  177. btn1: "否",
  178. btn2: "是",
  179. animation: 0,
  180. }).then((res) => {
  181. if (res) {
  182. this.orderAction('cancel');
  183. }
  184. });
  185. },
  186. payOrder() {
  187. this.$refs.paymentPopup.open();
  188. },
  189. selectPayment(method) {
  190. this.paymentMethod = method;
  191. },
  192. confirmPayment() {
  193. this.orderAction('pay', this.paymentMethod);
  194. this.$refs.paymentPopup.close();
  195. },
  196. refundOrder() {
  197. this.$refs.DialogBox.confirm({
  198. title: "提示",
  199. content: "确定要申请退款吗?",
  200. DialogType: "inquiry",
  201. btn1: "否",
  202. btn2: "是",
  203. animation: 0,
  204. }).then((res) => {
  205. if (res) {
  206. this.orderAction('refund');
  207. }
  208. });
  209. },
  210. deleteOrder() {
  211. this.$refs.DialogBox.confirm({
  212. title: "提示",
  213. content: "确定要删除订单吗?",
  214. DialogType: "inquiry",
  215. btn1: "否",
  216. btn2: "是",
  217. animation: 0,
  218. }).then((res) => {
  219. if (res) {
  220. this.orderAction('del');
  221. }
  222. });
  223. },
  224. confirmOrder() {
  225. this.$refs.DialogBox.confirm({
  226. title: "提示",
  227. content: "是否要确认收货吗?",
  228. DialogType: "inquiry",
  229. btn1: "否",
  230. btn2: "是",
  231. animation: 0,
  232. }).then((res) => {
  233. if (res) {
  234. this.orderAction('finish');
  235. }
  236. });
  237. },
  238. commentOrder() { },
  239. orderAction(act, payType = '') {
  240. uni.request({
  241. url: this.$apiHost + '/Order/action',
  242. method: 'GET',
  243. data: {
  244. order_id: this.orderId,
  245. act: act,
  246. payType: payType,
  247. uuid: getApp().globalData.uuid,
  248. skey: getApp().globalData.skey
  249. },
  250. success: (res) => {
  251. console.log(res.data, "订单操作结果");
  252. if (res.data && res.data.success == 'yes') {
  253. uni.showToast({ title: res.data.str, icon: 'none' });
  254. this.getOrderDetail(this.order.orderNo);
  255. if (act == 'cancel') {
  256. this.goBack();
  257. }
  258. } else {
  259. uni.showToast({ title: res.data.message || '操作失败', icon: 'none' });
  260. }
  261. },
  262. fail: () => {
  263. uni.showToast({ title: '操作失败', icon: 'none' });
  264. }
  265. });
  266. },
  267. getOrderDetail(orderId) {
  268. uni.request({
  269. url: this.$apiHost + '/Order/detail?order_id=' + orderId,
  270. method: 'GET',
  271. data: {
  272. uuid: getApp().globalData.uuid,
  273. skey: getApp().globalData.skey
  274. },
  275. success: (res) => {
  276. console.log(res.data.data, "获取订单详情");
  277. if (res.data && res.data.success == 'yes') {
  278. let data = res.data.data;
  279. if (data.address) {
  280. this.address = JSON.parse(data.address);
  281. }
  282. this.order = {
  283. orderNo: data.linkid,
  284. createTime: data.create_time,
  285. payTime: data.order_time,
  286. }
  287. if (data.crowdfund) {
  288. this.product = {
  289. price: data.crowdfund.price,
  290. img: data.crowdfund.image,
  291. title: data.crowdfund.title,
  292. desc: "",
  293. spec: data.crowdfund.title2,
  294. count: 1,
  295. total: data.money,
  296. deliveryTime: data.crowdfund.delivery,
  297. id: data.crowdfund.id,
  298. // tip: "温馨提示:该链接仅购买线下实物卡片!不含线上卡牌壁纸",
  299. }
  300. }
  301. this.status = data.status;
  302. this.statusTitle = data.status_name;
  303. }
  304. },
  305. fail: () => {
  306. uni.showToast({ title: '获取订单详情失败', icon: 'none' });
  307. },
  308. complete: () => {
  309. uni.hideLoading();
  310. }
  311. });
  312. },
  313. },
  314. mounted() {
  315. // 可根据实际订单状态设置statusType/statusTitle/statusIcon
  316. // 例如:this.statusType = 'waitPay'; this.statusTitle = '待支付';
  317. },
  318. };
  319. </script>
  320. <style lang="scss">
  321. .order-detail-page {
  322. min-height: 100vh;
  323. background: #f2f6f2;
  324. .custom-navbar {
  325. display: flex;
  326. flex-direction: row;
  327. align-items: center;
  328. justify-content: space-between;
  329. height: 90rpx;
  330. padding: 0 40rpx;
  331. padding-right: 30rpx;
  332. padding-top: var(--status-bar-height);
  333. background-color: transparent;
  334. position: sticky;
  335. top: 0;
  336. height: calc(90rpx + var(--status-bar-height));
  337. z-index: 100;
  338. .navbar-left {
  339. height: 80rpx;
  340. display: flex;
  341. align-items: center;
  342. justify-content: center;
  343. .fa-angle-left {
  344. font-size: 48rpx;
  345. color: #333;
  346. }
  347. }
  348. .navbar-right {
  349. width: 60rpx;
  350. height: 60rpx;
  351. display: flex;
  352. justify-content: center;
  353. align-items: center;
  354. }
  355. }
  356. .status-bar {
  357. display: flex;
  358. align-items: center;
  359. padding: 32rpx 32rpx 0 32rpx;
  360. .status-icon {
  361. width: 40rpx;
  362. height: 40rpx;
  363. margin-right: 12rpx;
  364. }
  365. .status-title {
  366. font-size: 36rpx;
  367. font-weight: bold;
  368. color: #1F1F1F;
  369. }
  370. }
  371. .address-card {
  372. background: #fff;
  373. border-radius: 16rpx;
  374. margin: 24rpx 16rpx 0 16rpx;
  375. padding: 24rpx;
  376. background: url("../../static/crowdFunding/order-detail-card-bg.png") no-repeat top right / auto 100%,
  377. #fff;
  378. .row {
  379. display: flex;
  380. align-items: center;
  381. margin-bottom: 8rpx;
  382. .name {
  383. font-size: 30rpx;
  384. font-weight: bold;
  385. margin-right: 18rpx;
  386. }
  387. .mobile {
  388. font-size: 30rpx;
  389. margin-right: 18rpx;
  390. }
  391. .default {
  392. font-size: 22rpx;
  393. color: #acf934;
  394. background: #1f1f1f;
  395. border-radius: 8rpx;
  396. padding: 2rpx 12rpx;
  397. margin-right: 12rpx;
  398. }
  399. }
  400. .address {
  401. font-size: 26rpx;
  402. color: #666;
  403. }
  404. }
  405. .product-card {
  406. background: #fff;
  407. border-radius: 16rpx;
  408. margin: 24rpx 16rpx 0 16rpx;
  409. padding: 24rpx;
  410. .product-top {
  411. display: flex;
  412. align-items: center;
  413. justify-content: space-between;
  414. .product-img {
  415. width: 120rpx;
  416. height: 120rpx;
  417. border-radius: 12rpx;
  418. margin-right: 18rpx;
  419. }
  420. .product-info {
  421. flex: 1;
  422. display: flex;
  423. align-items: center;
  424. justify-content: space-between;
  425. .product-title {
  426. width: 100%;
  427. display: flex;
  428. align-items: center;
  429. justify-content: space-between;
  430. font-size: 28rpx;
  431. font-weight: bold;
  432. color: #1f1f1f;
  433. display: flex;
  434. align-items: center;
  435. .two-omit {
  436. width: 400rpx;
  437. }
  438. .arrow {
  439. width: 60rpx;
  440. height: 60rpx;
  441. // margin-left: 140rpx;
  442. }
  443. }
  444. .product-desc {
  445. font-size: 24rpx;
  446. color: #1F1F1F;
  447. margin: 8rpx 0;
  448. }
  449. }
  450. }
  451. .product-bom {
  452. padding-top: 15rpx;
  453. .product-spec {
  454. font-size: 26rpx;
  455. color: #1F1F1F;
  456. margin: 8rpx 0;
  457. display: flex;
  458. align-items: center;
  459. justify-content: space-between;
  460. .count {
  461. color: #888;
  462. font-size: 22rpx;
  463. margin-top: 16rpx;
  464. margin-top: 8rpx;
  465. }
  466. }
  467. .product-time {
  468. font-size: 24rpx;
  469. color: #b2b2b2;
  470. margin-bottom: 8rpx;
  471. }
  472. .product-tip {
  473. font-size: 26rpx;
  474. color: #b2b2b2;
  475. background: #f6faf6;
  476. border-radius: 8rpx;
  477. padding: 8rpx 12rpx;
  478. }
  479. }
  480. .arrow {
  481. width: 32rpx;
  482. height: 32rpx;
  483. margin-left: 8rpx;
  484. }
  485. }
  486. .fee-row {
  487. display: flex;
  488. justify-content: space-between;
  489. align-items: center;
  490. padding: 0;
  491. height: 64rpx;
  492. font-size: 28rpx;
  493. color: #1F1F1F;
  494. text:first-child {
  495. color: #999;
  496. }
  497. &.total {
  498. font-weight: bold;
  499. color: #1f1f1f;
  500. justify-content: flex-end;
  501. text:first-child {
  502. color: #1f1f1f;
  503. }
  504. .total-price {
  505. color: #ff5500;
  506. font-size: 32rpx;
  507. }
  508. }
  509. }
  510. .order-info-card {
  511. background: #fff;
  512. border-radius: 16rpx;
  513. margin: 24rpx 16rpx 0 16rpx;
  514. padding: 24rpx;
  515. .info-row {
  516. display: flex;
  517. align-items: center;
  518. justify-content: space-between;
  519. height: 56rpx;
  520. font-size: 26rpx;
  521. >text:first-child {
  522. color: #999;
  523. }
  524. .copy-btn {
  525. color: #1f1f1f;
  526. background: #f6faf6;
  527. border-radius: 8rpx;
  528. font-size: 24rpx;
  529. margin-left: 18rpx;
  530. padding: 2rpx 16rpx;
  531. }
  532. }
  533. }
  534. .order-bottom {
  535. position: fixed;
  536. left: 0;
  537. right: 0;
  538. bottom: 0;
  539. background: #fff;
  540. display: flex;
  541. align-items: center;
  542. justify-content: flex-end;
  543. padding: 0 32rpx;
  544. height: 110rpx;
  545. box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.04);
  546. z-index: 10;
  547. .btn {
  548. min-width: 180rpx;
  549. height: 72rpx;
  550. line-height: 72rpx;
  551. border-radius: 44rpx;
  552. text-align: center;
  553. font-size: 30rpx;
  554. padding: 0 32rpx;
  555. margin-left: 24rpx;
  556. &.btn-pay {
  557. background: #1f1f1f;
  558. color: #acf934;
  559. }
  560. &.btn-cancel {
  561. background: #fff;
  562. color: #1f1f1f;
  563. border: 2rpx solid #e5e5e5;
  564. }
  565. &.btn-refund {
  566. background: #1f1f1f;
  567. color: #acf934;
  568. }
  569. &.btn-delete {
  570. background: #fff;
  571. color: #1f1f1f;
  572. border: 2rpx solid #e5e5e5;
  573. }
  574. &.btn-comment {
  575. background: #1f1f1f;
  576. color: #acf934;
  577. }
  578. }
  579. }
  580. .payment-popup {
  581. background: #fff;
  582. border-radius: 24rpx 24rpx 0 0;
  583. padding: 32rpx;
  584. .popup-header {
  585. display: flex;
  586. align-items: center;
  587. justify-content: space-between;
  588. margin-bottom: 32rpx;
  589. .popup-title {
  590. font-size: 32rpx;
  591. font-weight: bold;
  592. color: #1f1f1f;
  593. }
  594. }
  595. .payment-options {
  596. .payment-option {
  597. display: flex;
  598. align-items: center;
  599. padding: 24rpx 0;
  600. border-bottom: 2rpx solid #f6faf6;
  601. .payment-icon {
  602. width: 48rpx;
  603. height: 48rpx;
  604. margin-right: 18rpx;
  605. }
  606. .payment-name {
  607. flex: 1;
  608. font-size: 30rpx;
  609. color: #1f1f1f;
  610. }
  611. .payment-select {
  612. width: 32rpx;
  613. height: 32rpx;
  614. }
  615. }
  616. }
  617. .confirm-payment {
  618. margin-top: 32rpx;
  619. background: #1f1f1f;
  620. color: #acf934;
  621. border-radius: 44rpx;
  622. font-size: 32rpx;
  623. font-weight: bold;
  624. height: 88rpx;
  625. line-height: 88rpx;
  626. text-align: center;
  627. }
  628. }
  629. .btn-delete {
  630. background: #f6faf6;
  631. color: #888;
  632. border: 1px solid #e5e5e5;
  633. }
  634. }
  635. </style>