orderDetail.vue 18 KB

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