orderDetail.vue 17 KB

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