detail.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <template>
  2. <app-layout>
  3. <view class='status'>
  4. <image class='status-bg' :src='clerkImg.detail'></image>
  5. <view class="status-text" v-if="detail.is_use == 1 && detail.cancel_status == 0">已核销</view>
  6. <view class='status-info' v-if="detail.is_use == 1 ||detail.clerk_id > 0">
  7. <view v-if="card_id > 0">核销时间:{{detail.clerked_at}}</view>
  8. <view v-if="id > 0">核销时间:{{detail.orderClerk.updated_at}}</view>
  9. <view class="status-price" v-if="id > 0">核销金额:¥{{detail.total_pay_price}}</view>
  10. </view>
  11. <view class="status-text" v-if="(detail.is_use == 0 && card_id > 0) || (detail.clerk_id == 0&&detail.cancel_status == 0)">未核销</view>
  12. <view class="status-text" v-if="detail.cancel_status == 1">已退款</view>
  13. <view class='status-info' v-if="detail.cancel_status == 1">
  14. <view v-if="id > 0">退款时间:{{detail.cancel_time}}</view>
  15. </view>
  16. <view v-if="id > 0 && detail.store && detail.store.address" class='address-info'>
  17. <image src='./../image/address.png'></image>
  18. <view>{{detail.store.name ? detail.store.name : ''}} {{detail.store.mobile ? detail.store.mobile : ''}}</view>
  19. <view class="address">{{detail.store.address}}</view>
  20. </view>
  21. <view v-if="card_id > 0" class="card-info">
  22. <view class='dir-left-nowrap cross-center'>
  23. <image class="card-img" :src='detail.pic_url'></image>
  24. <view class="card-name t-omit-two">{{detail.card_name}}</view>
  25. </view>
  26. <view class='card-other'>
  27. <view v-if="detail.is_show_history" class="history-button" @click="isShow = true">
  28. <span>历史核销记录</span>
  29. <image class="icon" src="/static/image/icon/red-arrow.png"></image>
  30. </view>
  31. <view class='other-label'>有效时间</view>
  32. <view>{{detail.start_time}} - {{detail.end_time}}</view>
  33. <view class='other-label'>发放时间</view>
  34. <view>{{detail.created_at}}</view>
  35. <view class='other-label'>使用说明</view>
  36. <text>{{detail.content}}</text>
  37. </view>
  38. </view>
  39. </view>
  40. <view v-if="id > 0" class='order-info'>
  41. <view class="goods" :style="{'margin-top':`${index == 0 ?'0':'12'}px`}" v-for="goods in detail.detail" :key="goods.id">
  42. <image :src='goods.goods.goodsWarehouse.cover_pic'></image>
  43. <view class='goods-info'>
  44. <view class='goods-name t-omit-two'>{{goods.goods.goodsWarehouse.name}}</view>
  45. <view class="goods-attr t-omit-two">
  46. <text v-for="attr in goods.attr_list" :key="attr.id">{{attr.attr_group_name}}:{{attr.attr_name}}</text>
  47. </view>
  48. <view>x{{goods.num}}</view>
  49. </view>
  50. <view class='goods-price'>¥ {{goods.total_price ? goods.total_price : '0.00'}}</view>
  51. </view>
  52. <view class="main-between price-item">
  53. <view class="price-label">商品总价</view>
  54. <view>¥{{ detail.total_goods_price ? detail.total_goods_price : '0.00' }}</view>
  55. </view>
  56. <view class="main-between price-item">
  57. <view class="price-label">运费</view>
  58. <view>¥{{ detail.express_price ? detail.express_price : '0.00' }}</view>
  59. </view>
  60. <view class="main-between price-item" v-if="detail.member_discount_price > 0">
  61. <view class="price-label">会员折扣</view>
  62. <view>¥{{ detail.member_discount_price }}</view>
  63. </view>
  64. <view class="main-between price-item" v-if="detail.integral_deduction_price > 0">
  65. <view class="price-label">积分抵扣</view>
  66. <view>¥-{{ detail.integral_deduction_price }}</view>
  67. </view>
  68. <view class="main-between price-item" v-if="detail.coupon_discount_price > 0">
  69. <view class="price-label">优惠券抵扣</view>
  70. <view>-¥{{ detail.coupon_discount_price }}</view>
  71. </view>
  72. <view class="main-between price-item">
  73. <view class="price-label total-label">订单总价</view>
  74. <view class="total-price">¥{{ detail.total_pay_price ? detail.total_pay_price : '0.00' }}</view>
  75. </view>
  76. </view>
  77. <view class='order-info' v-if="detail.name">
  78. <view class='info-title'>收货信息</view>
  79. <view class="dir-left-nowrap price-item">
  80. <view class="price-label">收货人:</view>
  81. <view>{{detail.name}}</view>
  82. </view>
  83. <view class="dir-left-nowrap price-item">
  84. <view class="price-label">联系方式:</view>
  85. <view>{{detail.mobile}}</view>
  86. </view>
  87. </view>
  88. <view v-if="id > 0" class='order-info'>
  89. <view class='info-title'>订单信息</view>
  90. <view class="dir-left-nowrap price-item">
  91. <view class="price-label">下单时间:</view>
  92. <view>{{detail.created_at}}</view>
  93. </view>
  94. <view class="dir-left-nowrap price-item">
  95. <view class="price-label">订单号:</view>
  96. <view>{{detail.order_no}}</view>
  97. </view>
  98. <view class="dir-left-nowrap price-item" v-if="detail.remark">
  99. <view class="price-label">买家备注:</view>
  100. <view>{{detail.remark}}</view>
  101. </view>
  102. <view class="dir-left-nowrap price-item">
  103. <view class="price-label">支付方式:</view>
  104. <view v-if="detail.pay_type == 1">线上支付</view>
  105. <view v-else-if="detail.pay_type == 3">余额支付</view>
  106. <view v-else-if="detail.pay_type == 2">货到付款</view>
  107. <view v-else-if="detail.pay_type == 4">现金</view>
  108. <view v-else-if="detail.pay_type == 5">pos机</view>
  109. <view v-else>未支付</view>
  110. </view>
  111. <view class="dir-left-nowrap price-item">
  112. <view class="price-label">收货方式:</view>
  113. <view v-if="detail.send_type == 1">到店自提</view>
  114. <view v-if="detail.send_type == 0">快递配送</view>
  115. </view>
  116. </view>
  117. <view class='order-info' v-if="detail.orderClerk && detail.clerk">
  118. <view class='info-title'>核销信息</view>
  119. <view class="dir-left-nowrap price-item">
  120. <view class="price-label">核销员:</view>
  121. <view>{{detail.clerk.nickname}}</view>
  122. </view>
  123. <view class="dir-left-nowrap price-item">
  124. <view class="price-label">核销时间:</view>
  125. <view>{{detail.orderClerk.created_at}}</view>
  126. </view>
  127. <view class="dir-left-wrap price-item">
  128. <view class="price-label">核销备注:</view>
  129. <view>{{detail.orderClerk.clerk_remark}}</view>
  130. </view>
  131. </view>
  132. <view class='order-info' v-if="detail.id > 0 && (haveForm || detail.order_form.length > 0)">
  133. <app-form-data @show="showForm" :order="detail">
  134. <view class='info-title'>表单信息</view>
  135. </app-form-data>
  136. </view>
  137. <view v-if="detail.is_show_history == 1" class='order-info'
  138. :style="{'margin-bottom': `${detail.clerk_id > 0 ? '12':'28'}px;`}">
  139. <view class='info-title'>核销信息</view>
  140. <view class="dir-left-nowrap price-item">
  141. <view class="price-label">剩余次数:</view>
  142. <view>{{detail.number - detail.use_number}}次</view>
  143. </view>
  144. <view class="dir-left-nowrap price-item">
  145. <view class="price-label">已核销次数:</view>
  146. <view>{{detail.use_number}}次</view>
  147. </view>
  148. <view class="dir-left-nowrap price-item">
  149. <view class="price-label">总次数:</view>
  150. <view>{{detail.number}}次</view>
  151. </view>
  152. </view>
  153. <view style="height: 140rpx; width: 100%"></view>
  154. <view v-if="detail.clerk_id == 0 && id > 0 && detail.is_pay == 1 && detail.cancel_status == 0" @click="toClerk(detail.id)" class="to-clerk">
  155. <button>去核销</button>
  156. </view>
  157. <view v-if="detail.clerk_id == 0 && id > 0 && detail.is_pay == 0 && detail.cancel_status == 0" class="to-clerk" @click="checkPay=!checkPay">
  158. <button>确认收款</button>
  159. </view>
  160. <view v-if="detail.is_use == 0 && card_id > 0 && detail.receive_id == 0" @click="toClerkCard(detail.id)" class="to-clerk">
  161. <button>去核销</button>
  162. </view>
  163. <view class="bg cross-center main-center" v-if="checkPay">
  164. <view class="dialog">
  165. <view class="dialog-title">提示</view>
  166. <view class="dialog-msg">确认是否已当面支付款项给您!</view>
  167. <view class="dialog-btn main-center">
  168. <view @click="checkPay=!checkPay" class="dialog-close">取消</view>
  169. <view class="line"></view>
  170. <view class="dialog-submit" @click="clerkAffirmPay">确认</view>
  171. </view>
  172. </view>
  173. </view>
  174. <app-clerk-historys :user-card-id="detail.id" :is-show.sync="isShow"></app-clerk-historys>
  175. </app-layout>
  176. </template>
  177. <script>
  178. import appClerkHistorys from '../../../components/page-component/app-clerk-historys/app-clerk-historys.vue';
  179. import appFormData from "../../../components/basic-component/app-order/app-form-data.vue";
  180. import { mapState } from "vuex";
  181. export default {
  182. name: "detail",
  183. components: {
  184. appClerkHistorys,
  185. appFormData,
  186. },
  187. data() {
  188. return {
  189. haveForm: true,
  190. detail: {
  191. start_time: '',
  192. end_time: '',
  193. },
  194. card_id: null,
  195. checkPay: false,
  196. id: null,
  197. isShow: false,
  198. };
  199. },
  200. computed: {
  201. ...mapState({
  202. clerkImg: state => state.mallConfig.__wxapp_img.clerk,
  203. mall: state => state.mallConfig.mall
  204. }),
  205. },
  206. onLoad(options) { this.$commonLoad.onload(options);
  207. this.$showLoading({
  208. text: '加载中...'
  209. });
  210. if (options.id > 0) {
  211. this.id = options.id;
  212. uni.setNavigationBarTitle({
  213. title: "订单详情",
  214. })
  215. }else if (options.card_id > 0) {
  216. this.card_id = options.card_id;
  217. uni.setNavigationBarTitle({
  218. title: "卡券详情",
  219. })
  220. }
  221. },
  222. onShow: function() {
  223. if (this.id > 0) {
  224. this.getDetail();
  225. }else if (this.card_id > 0) {
  226. this.getCardDetail();
  227. }
  228. },
  229. methods: {
  230. showForm(e) {
  231. console.log(e)
  232. this.haveForm = e && e.length ? true : false
  233. },
  234. toClerk(id) {
  235. uni.navigateTo({
  236. url: '/pages/order/clerk/clerk?id=' + id
  237. });
  238. },
  239. toClerkCard(id) {
  240. uni.navigateTo({
  241. url: '/pages/card/clerk/clerk?cardId=' + id
  242. });
  243. },
  244. getDetail() {
  245. let that = this;
  246. that.$request({
  247. url: that.$api.clerk.detail,
  248. data: {
  249. order_id: this.id
  250. },
  251. }).then(response=>{
  252. that.$hideLoading();
  253. if(response.code == 0) {
  254. that.detail = response.data.order;
  255. }else {
  256. uni.showToast({
  257. title: response.msg,
  258. icon: 'none',
  259. duration: 1000
  260. });
  261. }
  262. }).catch(response => {
  263. that.$hideLoading();
  264. });
  265. },
  266. getCardDetail() {
  267. let that = this;
  268. that.$request({
  269. url: that.$api.clerk.card_detail,
  270. data: {
  271. cardId: this.card_id
  272. },
  273. }).then(response=>{
  274. that.$hideLoading();
  275. if(response.code == 0) {
  276. that.detail = response.data.card;
  277. }else {
  278. uni.showToast({
  279. title: response.msg,
  280. icon: 'none',
  281. duration: 1000
  282. });
  283. }
  284. }).catch(response => {
  285. that.$hideLoading();
  286. });
  287. },
  288. clerkAffirmPay() {
  289. let that = this;
  290. that.$request({
  291. url: that.$api.order.clerk_affirm_pay,
  292. data: {
  293. id: that.id,
  294. action_type: 1,
  295. },
  296. }).then(response=>{
  297. that.$hideLoading();
  298. if(response.code == 0) {
  299. that.checkPay = !that.checkPay;
  300. that.getDetail();
  301. }else {
  302. uni.showToast({
  303. title: response.msg,
  304. icon: 'none',
  305. duration: 1000
  306. });
  307. }
  308. }).catch(response => {
  309. that.$hideLoading();
  310. });
  311. }
  312. }
  313. }
  314. </script>
  315. <style scoped lang="scss">
  316. .status {
  317. position: relative;
  318. padding-top: #{140rpx};
  319. }
  320. .status-price {
  321. margin-top: #{4rpx};
  322. }
  323. .status-bg {
  324. position: absolute;
  325. top: 0;
  326. left: 0;
  327. height: #{220rpx};
  328. width: 100%;
  329. z-index: 0;
  330. }
  331. .status-text {
  332. font-size: #{32rpx};
  333. color: #fff;
  334. position: absolute;
  335. top: #{42rpx};
  336. left: #{48rpx};
  337. }
  338. .address-info {
  339. width: #{702rpx};
  340. margin: 0 auto;
  341. font-size: #{26rpx};
  342. color: #353535;
  343. background-color: #fff;
  344. border-radius: #{16rpx};
  345. position: relative;
  346. padding: #{28rpx} #{24rpx} #{28rpx} #{92rpx};
  347. }
  348. .address-info image {
  349. position: absolute;
  350. top: #{40rpx};
  351. left: #{24rpx};
  352. height: #{44rpx};
  353. width: #{44rpx};
  354. }
  355. .address {
  356. margin-top: #{8rpx};
  357. }
  358. .order-info {
  359. margin: #{24rpx} #{38rpx};
  360. padding: #{28rpx} #{24rpx};
  361. background-color: #fff;
  362. border-radius: #{16rpx};
  363. }
  364. .goods {
  365. height: #{160rpx};
  366. position: relative;
  367. margin-bottom: #{20rpx};
  368. }
  369. .goods image {
  370. height: #{160rpx};
  371. width: #{160rpx};
  372. border-radius: #{10rpx};
  373. float: left;
  374. margin-right: #{20rpx};
  375. }
  376. .goods-info {
  377. font-size: #{24rpx};
  378. color: #999999;
  379. }
  380. .goods-name {
  381. color: #353535;
  382. height: #{70rpx};
  383. }
  384. .goods-price {
  385. color: #353535;
  386. font-size: #{24rpx};
  387. position: absolute;
  388. bottom: 0;
  389. right: 0;
  390. }
  391. .total {
  392. font-size: #{24rpx};
  393. margin-top: #{28rpx};
  394. color: #999999;
  395. text-align: right;
  396. }
  397. .price-item {
  398. margin-top: #{10rpx};
  399. font-size: #{24rpx};
  400. color: #353535;
  401. }
  402. .price-item:first-of-type {
  403. margin-top: #{24rpx};
  404. }
  405. .price-label {
  406. color: #999;
  407. font-size: #{24rpx};
  408. }
  409. .price-label.total-label {
  410. font-size: #{24rpx};
  411. color:#353535;
  412. }
  413. .total-price {
  414. font-size: #{28rpx};
  415. color: #ff4544;
  416. font-weight: bold;
  417. }
  418. .info-title {
  419. font-size: #{24rpx};
  420. color: #353535;
  421. margin-bottom: #{20rpx};
  422. }
  423. .status-info {
  424. position: absolute;
  425. right: #{48rpx};
  426. top: #{42rpx};
  427. color: #fff;
  428. font-size: #{24rpx};
  429. text-align: right;
  430. }
  431. .to-clerk {
  432. position: fixed;
  433. bottom: 0;
  434. height: 140#{rpx};
  435. width: 100%;
  436. padding: 0 24#{rpx};
  437. border-top: 1#{rpx} solid #e2e2e2;
  438. background: #ffffff;
  439. display: flex;
  440. align-items: center;
  441. }
  442. .to-clerk button {
  443. width: #{702rpx};
  444. margin: 0 auto;
  445. font-size: #{32rpx};
  446. color: #fff;
  447. height: #{88rpx};
  448. line-height: #{88rpx};
  449. border-radius: #{44rpx};
  450. background-color: #ff4544;
  451. text-align: center;
  452. }
  453. .card-info {
  454. width: 90%;
  455. margin: 0 auto;
  456. border-radius: #{15rpx};
  457. background-color: #fff;
  458. position: relative;
  459. padding: #{40rpx} #{24rpx};
  460. margin-bottom: #{20rpx};
  461. }
  462. .card-img {
  463. height: #{88rpx};
  464. width: #{88rpx};
  465. margin-right: #{20rpx};
  466. border-radius: #{44rpx};
  467. }
  468. .card-name {
  469. font-size: #{32rpx};
  470. color: #353535;
  471. width: #{546rpx};
  472. }
  473. .info-label {
  474. color: #999999;
  475. }
  476. .card-other {
  477. text-align: left;
  478. font-size: #{28rpx};
  479. margin-top: #{40rpx};
  480. color: #353535;
  481. border-top: #{1rpx} solid #e2e2e2;
  482. }
  483. .other-label {
  484. color: #999999;
  485. margin: #{30rpx} 0 #{22rpx};
  486. }
  487. .bg {
  488. position: fixed;
  489. top: 0;
  490. left: 0;
  491. height: 100%;
  492. width: 100%;
  493. background-color: rgba(0, 0, 0, .3);
  494. z-index: 10;
  495. }
  496. .dialog {
  497. position: fixed;
  498. top: #{400rpx};
  499. left: 0;
  500. right: 0;
  501. height: #{300rpx};
  502. width: #{640rpx};
  503. margin: 0 auto;
  504. z-index: 21;
  505. background-color: #fff;
  506. border-radius: 10px;
  507. text-align: center;
  508. font-size: #{30rpx};
  509. }
  510. .dialog-title {
  511. margin: #{40rpx} auto #{35rpx};
  512. }
  513. .dialog-msg {
  514. color: #ff4544;
  515. }
  516. .dialog-btn {
  517. height: #{88rpx};
  518. width: #{640rpx};
  519. border-top: #{1rpx} solid #e2e2e2;
  520. line-height: #{88rpx};
  521. position: absolute;
  522. bottom: 0;
  523. left: 0;
  524. }
  525. .dialog-close,.dialog-submit {
  526. width: 50%;
  527. }
  528. .line {
  529. height: #{44rpx};
  530. margin-top: #{22rpx};
  531. width: #{1rpx};
  532. background-color: #e2e2e2;
  533. }
  534. .dialog-submit {
  535. color: #ff4544;
  536. }
  537. .goods-attr {
  538. margin-bottom: #{16rpx};
  539. }
  540. .goods-attr text {
  541. margin-right: #{18rpx};
  542. }
  543. .history-button {
  544. width: 215#{rpx};
  545. height:60#{rpx};
  546. padding:18#{rpx} 23#{rpx};
  547. display: flex;
  548. color: #ff4544;
  549. font-size:24#{rpx};
  550. margin:30#{rpx} 0;
  551. align-items: center;
  552. justify-content:center;
  553. background: #ffebeb;
  554. border-radius: 30#{rpx};
  555. .icon {
  556. width: 12#{rpx};
  557. height:22#{rpx};
  558. margin-left:12#{rpx};
  559. }
  560. }
  561. </style>