diffOrder.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. <template>
  2. <view class="container">
  3. <!-- 卡片 -->
  4. <view class="top-card">
  5. <view class="top-name">{{ orderInfo.goodsName }}</view>
  6. <view class="top-times">
  7. <!-- <view class="top-sku-name">{{orderInfo.skuName}}</view> -->
  8. <view>
  9. 剩余
  10. <text>{{ orderInfo.remainNumber }}</text>
  11. </view>
  12. <view class="serviced-times">
  13. 已服务
  14. <text>{{ orderInfo.servicedTimes }}</text>
  15. </view>
  16. </view>
  17. </view>
  18. <!-- 工单 -->
  19. <view class="service-list">
  20. <view class="service-item">
  21. <view class="service-title">
  22. <view class="sercive-name">服务{{ utils.servciceName(orderInfo.ofTimes) }}</view>
  23. <view class="service-id">工单编号:{{ orderInfo.bookDetailId }}</view>
  24. <view class="service-status">{{ orderInfo.statusName }}</view>
  25. </view>
  26. <view class="service-main">
  27. <view class="customer-info">
  28. <image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/jzmall-dy/icon-order-map.png"></image>
  29. <view class="customer-main">
  30. <view class="main-line">
  31. <view>{{ orderInfo.cusName }}</view>
  32. <view class="phone">{{ orderInfo.cusMobile }}</view>
  33. </view>
  34. <!-- <view class="customer-address" wx:if="{{orderInfo.address}}">{{orderInfo.addressName}}</view> -->
  35. <view class="customer-address">{{ orderInfo.address }}</view>
  36. </view>
  37. </view>
  38. <view class="row">
  39. <text>上门时段:</text>
  40. {{ orderInfo.bookTime }}
  41. </view>
  42. <view class="row">
  43. <text>预约备注:</text>
  44. {{ orderInfo.message }}
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <!-- 提示 -->
  50. <view class="diff-tips">
  51. <span v-if="'diffList.length >0'">您的服务还需支付补差费(若无需要,请忽略)</span>
  52. <span v-else>占无补差信息</span>
  53. </view>
  54. <view class="service-tips">如有任何疑问,请联系服务人员或客服</view>
  55. <view class="supply-order" @tap="diffDetail" :data-no="item.difNo" v-for="(item, index) in diffList" :key="index">
  56. <view class="order-title">
  57. <view>补差订单{{ index + 1 }}</view>
  58. <view :class="(item.state != 2 ? 'non-payment' : '') + ' pay-status'">
  59. {{ item.state == 0 || item.state == 1 ? '未支付' : item.state == 2 ? '已支付' : '取消' }}
  60. </view>
  61. </view>
  62. <view class="item-line">
  63. <view class="item-left">补差内容:</view>
  64. <view>{{ item.difName }}</view>
  65. </view>
  66. <view class="item-line">
  67. <view class="item-left">金额:</view>
  68. <view class="order-amount">¥ {{ item.difTotalPrice }}</view>
  69. </view>
  70. <view class="item-line">
  71. <view class="item-left">创建时间:</view>
  72. <view class="order-time">{{ item.createTime }}</view>
  73. </view>
  74. <view class="pay-btn" v-if="item.state == 0 || item.state == 1" @tap.stop.prevent="goPay" :data-no="item.difNo">立即支付</view>
  75. <view class="detail-btn" v-else>查看详情</view>
  76. </view>
  77. </view>
  78. </template>
  79. <script module="utils" lang="wxs" src="@/utils/formatFuc.wxs"></script>
  80. <script>
  81. var util = require('../../utils/util.js');
  82. var api = require('../../config/api.js');
  83. export default {
  84. data() {
  85. return {
  86. // 0创建,1发起支付中,2支付成功,3退款,4取消
  87. id: '',
  88. diffList: [],
  89. orderInfo: {
  90. goodsName: '',
  91. remainNumber: '',
  92. servicedTimes: '',
  93. bookDetailId: '',
  94. statusName: '',
  95. cusName: '',
  96. cusMobile: '',
  97. address: ''
  98. }
  99. };
  100. },
  101. onLoad: function (options) {
  102. // 页面初始化 options为页面跳转所带来的参数
  103. console.log(options);
  104. this.setData({
  105. id: options.id
  106. });
  107. // this.getDiffOrder();
  108. },
  109. onShow: function () {
  110. // 页面显示
  111. this.getDiffOrder();
  112. },
  113. onPullDownRefresh() {
  114. uni.showNavigationBarLoading(); //在标题栏中显示加载
  115. this.getDiffOrder();
  116. uni.hideNavigationBarLoading(); //完成停止加载
  117. uni.stopPullDownRefresh(); //停止下拉刷新
  118. },
  119. onReady: function () {
  120. // 页面渲染完成
  121. },
  122. onHide: function () {
  123. console.log('onHide');
  124. // clearInterval(this.data.timer);
  125. },
  126. onUnload: function () {
  127. console.log('onunload');
  128. },
  129. methods: {
  130. getDiffOrder: function () {
  131. uni.showLoading({
  132. title: '加载中'
  133. });
  134. util.request(api.getDiffList, {
  135. bookDetailId: this.id
  136. })
  137. .then((res) => {
  138. uni.hideLoading();
  139. if (res.errno === 0) {
  140. this.setData({
  141. diffList: res.data.diffList,
  142. orderInfo: res.data.bookDetail
  143. });
  144. }
  145. })
  146. .catch((err) => {
  147. console.log(err);
  148. uni.hideLoading();
  149. });
  150. },
  151. diffDetail(e) {
  152. let difNo = e.currentTarget.dataset.no;
  153. uni.navigateTo({
  154. url: '/pages/diffOrderDetail/diffOrderDetail?difNo=' + difNo
  155. });
  156. },
  157. goPay(e) {
  158. uni.showLoading({
  159. title: '加载中'
  160. });
  161. let difNo = e.currentTarget.dataset.no;
  162. util.request(api.prepayDiff, {
  163. diffOrderNo: difNo
  164. })
  165. .then((res) => {
  166. uni.hideLoading();
  167. if (res.errno === 0) {
  168. let payParam = res.data;
  169. uni.requestPayment({
  170. timeStamp: payParam.timeStamp,
  171. nonceStr: payParam.nonceStr,
  172. package: payParam.packageValue,
  173. signType: payParam.signType,
  174. paySign: payParam.paySign,
  175. success: function (res) {
  176. console.log('支付过程成功');
  177. uni.showToast({
  178. title: '支付成功',
  179. duration: 3000,
  180. mask: true
  181. });
  182. setTimeout(() => {
  183. uni.navigateTo({
  184. url: '/pages/diffOrderDetail/diffOrderDetail?difNo=' + difNo
  185. });
  186. }, 4000);
  187. },
  188. fail: function (res) {
  189. console.log('支付过程失败');
  190. util.showErrorToast('支付失败');
  191. },
  192. complete: function (res) {
  193. console.log('支付过程结束');
  194. }
  195. });
  196. } else {
  197. uni.showToast({
  198. title: res.errmsg,
  199. icon: 'none',
  200. duration: 3000
  201. });
  202. }
  203. })
  204. .catch((err) => {
  205. console.log(err);
  206. uni.hideLoading();
  207. });
  208. },
  209. // “去付款”按钮点击效果
  210. payOrder: function () {
  211. let that = this;
  212. util.request(
  213. api.OrderPayCheck,
  214. {
  215. orderId: that.orderInfo.id
  216. },
  217. 'POST'
  218. ).then(function (res) {
  219. if (res.errno === 0) {
  220. const outOrderNo = res.data;
  221. console.log(res);
  222. uni.continueToPay({
  223. // orderId: this.data.orderId, // 内部订单号
  224. outOrderNo: outOrderNo,
  225. // 外部订单号 2个订单号必填一个
  226. success: (res) => {
  227. console.log(res);
  228. const { orderId, outOrderNo } = res;
  229. console.log('success res', res);
  230. console.log('orderId', orderId, 'outOrderNo', outOrderNo);
  231. uni.redirectTo({
  232. url: '/pages/ucenter/order/order'
  233. });
  234. },
  235. fail: (res) => {
  236. console.log(res);
  237. const { orderId, outOrderNo, errNo, errMsg, errLogId } = res;
  238. if (errLogId) {
  239. console.log('查询订单信息失败', errNo, errMsg, errLogId);
  240. }
  241. if (orderId || outOrderNo) {
  242. console.log('支付失败', errNo, errMsg, orderId, outOrderNo);
  243. }
  244. util.showErrorToast('支付失败');
  245. }
  246. });
  247. }
  248. });
  249. }
  250. }
  251. };
  252. </script>
  253. <style>
  254. page {
  255. height: 100%;
  256. width: 100%;
  257. background: #f4f4f4;
  258. }
  259. .container {
  260. padding: 24rpx 0 180rpx;
  261. }
  262. /* 卡片 */
  263. .top-card {
  264. width: 702rpx;
  265. height: 164rpx;
  266. background: url('https://mall.zhaijieshi.cc/file/jzmall-dy/order-card-bg.png') no-repeat center;
  267. background-size: 100% 100%;
  268. padding: 20rpx 30rpx 24rpx;
  269. color: #fff;
  270. position: relative;
  271. margin: 0 24rpx 20rpx;
  272. }
  273. .top-name-wrapper {
  274. display: flex;
  275. align-items: center;
  276. justify-content: space-between;
  277. height: 44rpx;
  278. overflow: hidden;
  279. }
  280. .top-name {
  281. height: 44rpx;
  282. font-size: 32rpx;
  283. font-weight: bold;
  284. color: #ffffff;
  285. line-height: 44rpx;
  286. text-overflow: ellipsis;
  287. white-space: nowrap;
  288. overflow: hidden;
  289. }
  290. .top-sku-name {
  291. font-size: 24rpx;
  292. font-weight: bold;
  293. color: #fff;
  294. white-space: nowrap;
  295. overflow: hidden;
  296. text-overflow: ellipsis;
  297. flex: 1;
  298. }
  299. .top-times {
  300. margin: 12rpx 0 54rpx;
  301. display: flex;
  302. height: 42rpx;
  303. align-items: center;
  304. }
  305. .top-times view {
  306. font-size: 24rpx;
  307. font-weight: bold;
  308. }
  309. .top-times view.serviced-times {
  310. margin-left: 20rpx;
  311. }
  312. .top-times view text {
  313. font-size: 30rpx;
  314. }
  315. /* 工单列表 */
  316. .service-item {
  317. /* margin-top:24rpx; */
  318. background: #ffffff;
  319. border-radius: 24rpx;
  320. width: 702rpx;
  321. padding: 0 24rpx;
  322. margin: 0 24rpx;
  323. }
  324. .service-item .service-title {
  325. height: 80rpx;
  326. display: flex;
  327. align-items: center;
  328. border-bottom: 2rpx solid #e0e0e0;
  329. }
  330. .service-title .sercive-name {
  331. color: #191919;
  332. font-size: 30rpx;
  333. font-weight: bold;
  334. }
  335. .service-title .service-id {
  336. color: #666666;
  337. font-size: 24rpx;
  338. margin: 0 12rpx;
  339. flex: 1;
  340. }
  341. .service-title .service-status {
  342. color: #008dff;
  343. font-size: 26rpx;
  344. }
  345. .service-main {
  346. padding: 12rpx 0 16rpx;
  347. }
  348. .customer-info {
  349. display: flex;
  350. align-items: center;
  351. }
  352. .customer-info image {
  353. width: 48rpx;
  354. height: 48rpx;
  355. margin-right: 24rpx;
  356. }
  357. .customer-info .customer-main {
  358. display: flex;
  359. padding: 18rpx 0 4rpx;
  360. flex-direction: column;
  361. flex: 1;
  362. }
  363. .main-line {
  364. display: flex;
  365. height: 44rpx;
  366. margin-bottom: 4rpx;
  367. align-items: center;
  368. }
  369. .main-line view {
  370. color: #333333;
  371. font-size: 32rpx;
  372. }
  373. .main-line view.phone {
  374. color: #999999;
  375. font-size: 24rpx;
  376. margin-left: 14rpx;
  377. }
  378. .customer-info .customer-address {
  379. color: #666666;
  380. line-height: 40rpx;
  381. }
  382. .service-main .row {
  383. /* height: 56rpx;
  384. line-height: 56rpx; */
  385. display: flex;
  386. color: rgba(0, 0, 0, 0.9);
  387. font-size: 26rpx;
  388. font-weight: bold;
  389. align-items: center;
  390. margin: 10rpx 0;
  391. }
  392. .service-main .row text {
  393. color: #666666;
  394. font-weight: normal;
  395. /* white-space: nowrap; */
  396. }
  397. .diff-tips {
  398. height: 56rpx;
  399. font-size: 36rpx;
  400. color: #333333;
  401. line-height: 56rpx;
  402. margin: 28rpx 0 12rpx;
  403. text-align: center;
  404. font-weight: bold;
  405. }
  406. .service-tips {
  407. height: 42rpx;
  408. font-size: 30rpx;
  409. font-weight: 400;
  410. color: #999999;
  411. line-height: 42rpx;
  412. margin-bottom: 30rpx;
  413. text-align: center;
  414. }
  415. .supply-order {
  416. background: #fff;
  417. margin-bottom: 12rpx;
  418. padding-bottom: 32rpx;
  419. }
  420. .order-title {
  421. height: 80rpx;
  422. padding: 0 24rpx 0 48rpx;
  423. border-bottom: 1rpx solid #f3f3f3;
  424. color: #666666;
  425. font-size: 28rpx;
  426. margin-bottom: 20rpx;
  427. display: flex;
  428. align-items: center;
  429. justify-content: space-between;
  430. }
  431. .pay-status {
  432. font-weight: 600;
  433. color: #09afff;
  434. }
  435. .non-payment.pay-status {
  436. color: #ff004e;
  437. }
  438. .item-line .order-amount {
  439. color: #191919;
  440. }
  441. .item-line .order-time {
  442. color: #191919;
  443. }
  444. .supply-item {
  445. background: #fff;
  446. margin-bottom: 10rpx;
  447. padding-bottom: 10rpx;
  448. }
  449. .item-title {
  450. height: 80rpx;
  451. line-height: 80rpx;
  452. padding-left: 48rpx;
  453. border-bottom: 1rpx solid #f3f3f3;
  454. color: #666666;
  455. font-size: 28rpx;
  456. margin-bottom: 20rpx;
  457. }
  458. .item-line {
  459. display: flex;
  460. justify-content: space-between;
  461. align-items: center;
  462. padding: 0 24rpx 0 48rpx;
  463. height: 48rpx;
  464. margin-bottom: 4rpx;
  465. }
  466. .item-line view {
  467. font-size: 28rpx;
  468. color: #666;
  469. }
  470. .item-line view.item-left {
  471. color: #999;
  472. }
  473. .detail-btn {
  474. width: 676rpx;
  475. height: 66rpx;
  476. line-height: 66rpx;
  477. border-radius: 3rpx;
  478. border: 1rpx solid #d4d4d4;
  479. color: #666666;
  480. font-size: 28rpx;
  481. margin: 14rpx 0 0 48rpx;
  482. text-align: center;
  483. }
  484. .pay-btn {
  485. width: 676rpx;
  486. height: 66rpx;
  487. line-height: 66rpx;
  488. border-radius: 3rpx;
  489. color: #fff;
  490. font-size: 28rpx;
  491. margin: 14rpx 0 0 48rpx;
  492. text-align: center;
  493. background: #09afff;
  494. }
  495. </style>