orderDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. <template>
  2. <view class="success" :style="{ background: `url(${bgImg}) #F4F5F9` }">
  3. <view class="success_status">
  4. <view class="status flex aic">
  5. <view class="status_text">{{ orderInfo.paymentStatus | orderStatus }}</view>
  6. </view>
  7. </view>
  8. <view class="success_content">
  9. <view class="success_info">
  10. <view class="">
  11. <view class="success_item flex jcsb aic">
  12. <view class="flex aic">
  13. <view class="label">收件地址</view>
  14. <text class="bold">{{ orderInfo.email }}</text>
  15. </view>
  16. <!-- <view class="success_btn" @click="copyText()">复制</view>-->
  17. </view>
  18. <view class="success_item flex aic">
  19. <view class="label">收件人</view>
  20. <text>{{ orderInfo.recipientName }}({{ orderInfo.contactPhone }})</text>
  21. </view>
  22. <view v-if="orderInfo.completedLink" class="success_item flex aic">
  23. <view class="label">拍摄视频地址</view>
  24. <u-link :href="baiduLink" text="百度云盘链接" @click="click"></u-link>
  25. <view class="copy" @click="copyText(orderInfo.completedLink)">复制</view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="line" :style="{ background: `url(${successImg}) no-repeat` }">
  30. <view class="line-circle"></view>
  31. </view>
  32. <view class="detail">
  33. <view class="detail_item flex aic jcsb">
  34. <text>订单金额</text>
  35. <view class="datas flex">
  36. <text>{{ orderInfo.totalAmount }}元</text>
  37. </view>
  38. </view>
  39. <view class="detail_item flex aic jcsb" @click="goCase">
  40. <text>套餐名称</text>
  41. <view class="datas flex">
  42. <text>{{ orderInfo.packageName }}</text>
  43. <view class="copy">详情</view>
  44. </view>
  45. </view>
  46. <view class="detail_item flex aic jcsb">
  47. <text>套餐内容</text>
  48. <view class="datas flex">
  49. <text>{{ orderInfo.quantity }}条 (每条15-20s)</text>
  50. </view>
  51. </view>
  52. <view class="detail_item flex aic jcsb" v-if="orderInfo.paymentStatus!=='WAIT_PAYMENT'">
  53. <text>支付方式</text>
  54. <view class="datas flex">
  55. <text>微信支付</text>
  56. </view>
  57. </view>
  58. <view class="detail_item flex aic jcsb">
  59. <text>订单编号</text>
  60. <view class="datas flex">
  61. <text>{{ orderInfo.orderNumber }}</text>
  62. <view class="copy" @click="copyText(orderInfo.orderNumber)">复制</view>
  63. </view>
  64. </view>
  65. <view class="detail_item flex aic jcsb">
  66. <text>订单时间</text>
  67. <view class="datas flex">
  68. <text>{{ orderInfo.createDate }}</text>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="btns">
  74. <view v-if="orderInfo.paymentStatus==='WAIT_PAYMENT'" class="order-bottom-right flex">
  75. <view class="btn btn1 p2" @click.stop="handleCancelOrder(orderInfo.orderId)">取消</view>
  76. <view class="btn btn2 p1" @click.stop="submitOrder(orderInfo)">支付</view>
  77. </view>
  78. <view v-else class="order-bottom-right flex">
  79. <view class="btn btn1 p2" v-if="orderInfo.paymentStatus==='WAIT_SEND'"
  80. @click.stop="handleCancelOrder(orderInfo.orderId)">
  81. 取消
  82. </view>
  83. <view class="btn btn1 p2" v-if="orderInfo.paymentStatus==='WAIT_ORDER'"
  84. @click.stop="handleCancelOrder(orderInfo.orderId)">
  85. 取消
  86. </view>
  87. <view v-if="orderInfo.paymentStatus==='WAIT_SEND'" class="btn btn1 p2 ml-6 btn-theme">寄样</view>
  88. <view class="btn btn1 p2" v-if="orderInfo.paymentStatus==='SHOOTING'"
  89. @click.stop="handleAftermarketOrder(orderInfo.orderId)">申请售后
  90. </view>
  91. <view class="btn btn1 p2" v-if="orderInfo.paymentStatus==='DELIVERED'"
  92. @click.stop="handleAftermarketOrder(orderInfo.orderId)">申请售后
  93. </view>
  94. <view class="btn btn1 p2" v-if="orderInfo.paymentStatus==='WAIT_CHECK'"
  95. @click.stop="handleAftermarketOrder(orderInfo.orderId)">申请售后
  96. </view>
  97. <view class="btn btn1 p2" v-if="orderInfo.paymentStatus==='AFTER_SALE'"
  98. @click.stop="handleCancelAftermarketOrder(orderInfo.orderId)">撤回申请
  99. </view>
  100. <view class="btn btn1 p2 ml-6 btn-theme" v-if="orderInfo.paymentStatus==='WAIT_CHECK'"
  101. @click.stop="handleCheckOrder(orderInfo.orderId)">确认验收
  102. </view>
  103. </view>
  104. <view class="back" @click="goHome">返回首页</view>
  105. </view>
  106. </view>
  107. </template>
  108. <script>
  109. import {
  110. copy
  111. } from "@/utils/utils";
  112. import {
  113. aftermarketOrder,
  114. cancelAftermarketOrder,
  115. cancelOrder,
  116. checkOrder,
  117. getOrderDetail,
  118. updateOrder
  119. } from "../../apis/order";
  120. import {
  121. goHome
  122. } from "../../utils/utils";
  123. import {
  124. submitOrder
  125. } from "../../apis";
  126. export default {
  127. components: {},
  128. data() {
  129. return {
  130. orderId: '',
  131. orderInfo: {
  132. completedLink: '',
  133. paymentStatus: '',
  134. packageName: "",
  135. createDate: "",
  136. orderNumber: '',
  137. shootingRequirements: '',
  138. email: '',
  139. },
  140. bgImg: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/bg_top%403x.png",
  141. payImg: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_paysuccess.png",
  142. successImg: 'https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/img_quekou.png'
  143. };
  144. },
  145. onLoad(options) {
  146. if (options.orderId) {
  147. this.orderId = options.orderId;
  148. }
  149. this.getData();
  150. },
  151. computed: {
  152. baiduLink() {
  153. const linkRegex = /链接:\s*(https:\/\/pan.baidu.com\/s\/\S+)/;
  154. const codeRegex = /提取码:\s*(\w+)/;
  155. const linkMatch = this.orderInfo.completedLink.match(linkRegex);
  156. const codeMatch = this.orderInfo.completedLink.match(codeRegex);
  157. let link = "";
  158. let accessCode = "";
  159. if (linkMatch && linkMatch.length > 1) {
  160. link = linkMatch[1];
  161. }
  162. if (codeMatch && codeMatch.length > 1) {
  163. accessCode = codeMatch[1];
  164. }
  165. return link +'?pwd='+ accessCode
  166. }
  167. },
  168. watch: {
  169. // 可以在这里添加监听器,例如监听订单状态变化后更新页面显示
  170. },
  171. methods: {
  172. getData() {
  173. getOrderDetail({
  174. orderId: this.orderId
  175. }).then(res => {
  176. this.orderInfo = res;
  177. });
  178. },
  179. goCase() {
  180. uni.navigateTo({
  181. url: '/pages/index/detail?type=1'
  182. });
  183. },
  184. goHome() {
  185. goHome();
  186. },
  187. // 复制
  188. copyText(text) {
  189. copy(text);
  190. },
  191. // 处理取消订单逻辑
  192. handleCancelOrder(orderId) {
  193. this.showConfirmModal('你确定要取消订单吗?', () => {
  194. cancelOrder({
  195. orderId: Number(orderId)
  196. }).then(() => {
  197. uni.navigateBack();
  198. });
  199. });
  200. },
  201. // 处理更新订单逻辑
  202. handleUpdateOrder(orderId) {
  203. this.showConfirmModal('你确定要取消订单吗?', () => {
  204. updateOrder({
  205. orderId: Number(orderId),
  206. }).then(() => {
  207. uni.navigateBack();
  208. });
  209. });
  210. },
  211. // 处理确认验收逻辑
  212. handleCheckOrder(orderId) {
  213. this.showConfirmModal('你确定要验收该订单吗?', () => {
  214. checkOrder({
  215. orderId: Number(orderId),
  216. }).then(() => {
  217. uni.navigateBack();
  218. });
  219. });
  220. },
  221. // 处理申请售后逻辑
  222. handleAftermarketOrder(orderId) {
  223. this.showConfirmModal('你确定要申请售后吗?', () => {
  224. aftermarketOrder({
  225. orderId: Number(orderId)
  226. }).then(() => {
  227. uni.navigateBack();
  228. });
  229. });
  230. },
  231. // 处理撤销售后逻辑
  232. handleCancelAftermarketOrder(orderId) {
  233. this.showConfirmModal('你确定要撤销售后吗?', () => {
  234. cancelAftermarketOrder({
  235. orderId: Number(orderId)
  236. }).then(() => {
  237. uni.navigateBack();
  238. });
  239. });
  240. },
  241. // 显示确认模态框的通用函数
  242. showConfirmModal(content, confirmCallback) {
  243. uni.showModal({
  244. title: '提示',
  245. content: content,
  246. success: function(res) {
  247. if (res.confirm) {
  248. confirmCallback();
  249. } else if (res.cancel) {
  250. console.log('用户点击取消');
  251. }
  252. }
  253. });
  254. },
  255. submitOrder(params) {
  256. submitOrder({
  257. ...params
  258. }).then((res) => {
  259. // 检查是否在微信浏览器中
  260. if (typeof WeixinJSBridge === 'undefined') {
  261. if (document.addEventListener) {
  262. document.addEventListener('WeixinJSBridgeReady', () => {
  263. this.invokePayment(res);
  264. }, false);
  265. } else if (document.attachEvent) {
  266. document.attachEvent('WeixinJSBridgeReady', () => {
  267. this.invokePayment(res);
  268. });
  269. document.attachEvent('onWeixinJSBridgeReady', () => {
  270. this.invokePayment(res);
  271. });
  272. }
  273. } else {
  274. this.invokePayment(res);
  275. }
  276. });
  277. },
  278. invokePayment(rePayInfo) {
  279. WeixinJSBridge.invoke(
  280. 'getBrandWCPayRequest', {
  281. appId: rePayInfo.appid,
  282. timeStamp: rePayInfo.timeStamp,
  283. nonceStr: rePayInfo.nonceStr,
  284. package: rePayInfo.packages,
  285. signType: rePayInfo.signType,
  286. paySign: rePayInfo.sign
  287. },
  288. (res) => {
  289. if (res.err_msg === 'get_brand_wcpay_request:ok') {
  290. this.getData();
  291. } else if (res.err_msg === 'get_brand_wcpay_request:cancel') {
  292. uni.showToast({
  293. title: '用户取消了支付'
  294. });
  295. } else {
  296. console.error('支付失败', res.err_msg);
  297. // 处理支付失败的逻辑
  298. }
  299. }
  300. );
  301. },
  302. },
  303. created() {
  304. // 可以在这里添加组件创建时的初始化逻辑
  305. },
  306. mounted() {
  307. // 可以在这里添加组件挂载后的逻辑,例如绑定一些事件监听器等
  308. },
  309. };
  310. </script>
  311. <style lang='scss' scoped>
  312. .success {
  313. width: 100%;
  314. position: absolute;
  315. top: 0;
  316. bottom: 0;
  317. display: flex;
  318. flex-direction: column;
  319. background-size: contain !important;
  320. background-repeat: no-repeat !important;
  321. background-position: top;
  322. padding: 0 24rpx;
  323. .success_status {
  324. margin-top: 64rpx;
  325. display: flex;
  326. flex-direction: column;
  327. align-items: center;
  328. .pay_img {
  329. width: 48rpx;
  330. height: 48rpx;
  331. margin-left: 16rpx;
  332. }
  333. .status_text {
  334. font-weight: 500;
  335. font-size: 40rpx;
  336. color: #0D121A;
  337. }
  338. .status_tip {
  339. font-weight: 400;
  340. font-size: 28rpx;
  341. color: #9EA3B1;
  342. margin-top: 20rpx;
  343. }
  344. }
  345. .success_content {
  346. border-radius: 32rpx;
  347. overflow: hidden;
  348. margin-top: 64rpx;
  349. .success_info {
  350. background-color: #fff;
  351. padding: 36rpx 32rpx 8rpx;
  352. .success_item {
  353. margin-bottom: 20rpx;
  354. .label {
  355. min-width: 120rpx;
  356. font-weight: 400;
  357. font-size: 28rpx;
  358. color: #9EA3B1;
  359. margin-right: 16rpx;
  360. }
  361. text {
  362. font-size: 32rpx;
  363. color: #0D121A;
  364. }
  365. }
  366. }
  367. .success_btn {
  368. width: 80rpx;
  369. height: 40rpx;
  370. font-weight: 500;
  371. background: #F4F5F9;
  372. border-radius: 48rpx;
  373. font-size: 24rpx;
  374. color: #0D121A;
  375. text-align: center;
  376. line-height: 40rpx;
  377. }
  378. .line {
  379. width: 100%;
  380. height: 40rpx;
  381. background-size: cover !important;
  382. padding: 0 32rpx;
  383. display: flex;
  384. justify-content: center;
  385. align-items: center;
  386. .line-circle {
  387. width: 100%;
  388. border: 2rpx dashed #EDEDED;
  389. height: 2rpx;
  390. }
  391. }
  392. .detail {
  393. background-color: #fff;
  394. padding: 32rpx 32rpx 40rpx;
  395. .detail_item {
  396. margin-bottom: 36rpx;
  397. text {
  398. white-space: nowrap;
  399. font-weight: 400;
  400. font-size: 28rpx;
  401. color: #0D121A;
  402. }
  403. .datas {
  404. .copy {
  405. width: 80rpx;
  406. height: 40rpx;
  407. background: #F4F5F9;
  408. border-radius: 48rpx;
  409. font-weight: 500;
  410. font-size: 24rpx;
  411. color: #061714;
  412. text-align: center;
  413. line-height: 40rpx;
  414. margin-left: 16rpx;
  415. }
  416. }
  417. }
  418. .detail_item:nth-last-child(1) {
  419. margin-bottom: 0;
  420. }
  421. }
  422. .success_title {
  423. color: #9DA3A2;
  424. }
  425. }
  426. .btns {
  427. padding: 96rpx 32rpx;
  428. view {
  429. width: 100%;
  430. height: 84rpx;
  431. // border-radius: 48rpx;
  432. display: flex;
  433. justify-content: center;
  434. align-items: center;
  435. font-size: 32rpx;
  436. }
  437. .bind {
  438. color: #061714;
  439. margin-bottom: 32rpx;
  440. font-weight: 500rpx;
  441. background: linear-gradient(140deg, #246AF1 0%, #2F98EF 100%);
  442. }
  443. .back {
  444. font-weight: bold;
  445. background: #FFFFFF;
  446. // border: 4rpx solid #E7EAEA;
  447. color: #061714;
  448. }
  449. }
  450. .ml16 {
  451. margin-left: 16rpx;
  452. }
  453. }
  454. .order-bottom-right {
  455. margin-bottom: 36rpx;
  456. }
  457. .copy {
  458. width: 80rpx;
  459. height: 40rpx;
  460. background: #F4F5F9;
  461. border-radius: 48rpx;
  462. font-weight: 500;
  463. font-size: 24rpx;
  464. color: #061714;
  465. text-align: center;
  466. line-height: 40rpx;
  467. margin-left: 16rpx;
  468. }
  469. </style>