clerk.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. <template>
  2. <app-layout>
  3. <view v-if="is_show" class='clerk-box'>
  4. <view class='order-info'>
  5. <view class='dir-left-nowrap'>
  6. <view class='info-label'>收货人:</view>
  7. <view>
  8. <view>{{orderDetail.name}}</view>
  9. </view>
  10. </view>
  11. <view class='dir-left-nowrap'>
  12. <view class='info-label'>联系方式:</view>
  13. <view>
  14. <view>{{orderDetail.mobile}}</view>
  15. </view>
  16. </view>
  17. <view class='line'></view>
  18. <view>
  19. <text class='info-label'>下单时间:</text>
  20. {{orderDetail.created_at}}
  21. </view>
  22. <view class="remark-box" v-if="orderDetail.remark">
  23. <text class='info-label'>买家留言:</text>
  24. {{orderDetail.remark}}
  25. </view>
  26. </view>
  27. <view class='goods-box'>
  28. <view v-for='item in orderDetail.detail' :style="{'margin-top': index == 0 ? '0': '24rpx'}"
  29. :key='item.id'>
  30. <app-jump-button :url="item.goods_info.page_url">
  31. <app-order-goods-info style="width:100%;" :goods='item.goods_info'></app-order-goods-info>
  32. </app-jump-button>
  33. </view>
  34. </view>
  35. <view class='order-info dir-top-nowrap'>
  36. <view class='dir-left-nowrap item'>
  37. <view class='box-grow-1 info-label'>商品总额</view>
  38. <view class='box-grow-0'>¥{{orderDetail.total_goods_price}}</view>
  39. </view>
  40. <view class='dir-left-nowrap item'>
  41. <view class='box-grow-1 info-label'>商品总数</view>
  42. <view class='box-grow-0'>x{{orderDetail.goods_num}}</view>
  43. </view>
  44. <view v-if='orderDetail.integral_deduction_price > 0' class='dir-left-nowrap item'>
  45. <view class='box-grow-1 info-label'>积分抵扣</view>
  46. <view class='box-grow-0'>-¥{{orderDetail.integral_deduction_price}}</view>
  47. </view>
  48. <view class='dir-left-nowrap item' v-if="orderDetail.coupon_discount_price > 0">
  49. <view class='box-grow-1 info-label'>优惠券优惠</view>
  50. <view class='box-grow-0'>-¥{{orderDetail.coupon_discount_price}}</view>
  51. </view>
  52. <view class='dir-left-nowrap item'>
  53. <view class='box-grow-1 info-label'>运费</view>
  54. <view class='box-grow-0'>¥{{orderDetail.express_price}}</view>
  55. </view>
  56. <view v-if='orderDetail.words' class='dir-top-nowrap item'>
  57. <view class='box-grow-1 info-label'>商家留言:</view>
  58. <view class='box-grow-0 t-extra-small-color'>{{orderDetail.words}}</view>
  59. </view>
  60. <view class='order-price-box cross-center dir-right-nowrap'>
  61. <view>
  62. 合计:
  63. <text class='price'>¥
  64. <text>{{orderDetail.total_pay_price}}</text>
  65. </text>
  66. </view>
  67. </view>
  68. </view>
  69. <view class='order-info' v-if="orderDetail.id > 0 && (haveForm || orderDetail.order_form.length > 0)">
  70. <app-form-data @show="showForm" :order="orderDetail">
  71. <view class='info-title'>表单信息</view>
  72. </app-form-data>
  73. </view>
  74. <view style="height: 140rpx; width: 100%"></view>
  75. <view class='action-box'>
  76. <view v-if='orderDetail.is_pay == 0'>
  77. <button class='box-grow-0 btn' @click='clerkAffirmPay'>确认收款</button>
  78. </view>
  79. <view v-else>
  80. <view v-if='orderDetail.is_pay == 1 && orderDetail.clerk_id == 0' class="dir-left-nowrap cross-center">
  81. <view @click="orderClerkRemark" class="dir-top-nowrap box-grow-0 cross-center left-box">
  82. <image :src="clerkImg.edit" class="edit-icon"></image>
  83. <view class="edit-remark">备注</view>
  84. </view>
  85. <button @click='orderClerk'
  86. class='box-grow-1 btn'>
  87. 核销订单
  88. </button>
  89. </view>
  90. <view class="cross-center main-center clerk-text" v-else>订单已核销</view>
  91. </view>
  92. </view>
  93. </view>
  94. <view v-if="msg" class='bg cross-center main-center'>
  95. <view class='dialog'>
  96. <view>提示</view>
  97. <view class='dialog-content'>无核销权限</view>
  98. <view @click='toIndex' class='dialog-btn'>确认</view>
  99. </view>
  100. </view>
  101. <view v-if="remarkClerk" class='bg cross-center main-center'>
  102. <view class='remark-dialog'>
  103. <view class="title">备注</view>
  104. <textarea class="textarea" v-model="clerk_remark" placeholder="请输入核销备注"/>
  105. <view class="dir-left-nowrap bottom-box">
  106. <view @click="remarkClerk = false" class="box-grow-1 cross-center main-center cancel-text">取消</view>
  107. <view @click="orderClerk" class="box-grow-1 cross-center main-center clerk-text">核销订单</view>
  108. </view>
  109. </view>
  110. </view>
  111. </app-layout>
  112. </template>
  113. <script>
  114. import { mapState } from 'vuex';
  115. import appOrderGoodsInfo from "../../../components/page-component/app-order-goods-info/app-order-goods-info.vue";
  116. import appFormData from "../../../components/basic-component/app-order/app-form-data.vue";
  117. export default {
  118. components: {
  119. 'app-order-goods-info': appOrderGoodsInfo,
  120. appFormData,
  121. },
  122. data() {
  123. return {
  124. haveForm: true,
  125. id: null,
  126. orderDetail: {},
  127. clerk_remark: '',
  128. is_show: false,
  129. msg: false,
  130. remarkClerk: false,
  131. }
  132. },
  133. computed: {
  134. ...mapState({
  135. userInfo: state => state.user.info,
  136. clerkImg: state => state.mallConfig.__wxapp_img.clerk,
  137. })
  138. },
  139. methods: {
  140. showForm(e) {
  141. this.haveForm = e && e.length ? true : false
  142. },
  143. toIndex() {
  144. uni.redirectTo({
  145. url: '/pages/index/index'
  146. });
  147. },
  148. getOrderDetail() {
  149. this.$request({
  150. url: this.$api.order.detail,
  151. data: {
  152. id: this.id,
  153. action_type: 1
  154. }
  155. }).then(response => {
  156. this.$hideLoading();
  157. this.is_show = true;
  158. if (response.code === 0) {
  159. this.orderDetail = response.data.detail;
  160. }
  161. }).catch(() => {
  162. this.$hideLoading();
  163. });
  164. },
  165. IsClerk() {
  166. this.$showLoading();
  167. this.$request({
  168. url: this.$api.user.is_clerk,
  169. data: {
  170. clerk_id: this.userInfo.options.user_id,
  171. }
  172. }).then(response => {
  173. if (response.code === 0) {
  174. if(response.data.is_clerk_user == 1) {
  175. this.getOrderDetail();
  176. }else {
  177. this.$hideLoading();
  178. this.msg = true;
  179. }
  180. }
  181. }).catch(() => {
  182. this.$hideLoading();
  183. });
  184. },
  185. clerkAffirmPay() {
  186. let self = this;
  187. uni.showModal({
  188. title: '提示',
  189. content: '确认已进行线下收款?',
  190. success: function (res) {
  191. if (res.confirm) {
  192. uni.showLoading({
  193. title: '加载中'
  194. });
  195. self.$request({
  196. url: self.$api.order.clerk_affirm_pay,
  197. data: {
  198. id: self.id,
  199. action_type: 1,
  200. }
  201. }).then(response => {
  202. uni.hideLoading();
  203. if (response.code === 0) {
  204. self.getOrderDetail();
  205. } else {
  206. uni.showToast({
  207. title: response.msg,
  208. icon: 'none',
  209. });
  210. }
  211. this.msg = response.data.msg
  212. }).catch(() => {
  213. uni.hideLoading();
  214. });
  215. }
  216. }
  217. });
  218. },
  219. orderClerk() {
  220. let self = this;
  221. if (self.remarkClerk) {
  222. self.remarkClerk = false;
  223. }
  224. uni.showModal({
  225. content: '是否核销订单?',
  226. success: function (res) {
  227. if (res.confirm) {
  228. self.$showLoading();
  229. self.$request({
  230. url: self.$api.order.order_clerk,
  231. data: {
  232. id: self.id,
  233. action_type: 1,
  234. clerk_remark: self.clerk_remark
  235. }
  236. }).then(response => {
  237. self.$hideLoading();
  238. uni.showToast({
  239. title: response.msg,
  240. icon: 'none',
  241. duration: 2000,
  242. success: function() {
  243. if (response.code === 0) {
  244. setTimeout(()=> {
  245. uni.redirectTo({
  246. url: '/plugins/clerk/order/order?status=1&type=1'
  247. })
  248. }, 2000);
  249. }
  250. }
  251. })
  252. }).catch(() => {
  253. self.$hideLoading();
  254. });
  255. }
  256. }
  257. })
  258. },
  259. orderClerkRemark()
  260. {
  261. this.remarkClerk = true;
  262. },
  263. closeDialog() {
  264. if (this.msg == '核销成功') {
  265. this.msg = '';
  266. if (this.is_clerk) {
  267. let pages = getCurrentPages();
  268. let idx;
  269. pages.forEach((row, index) => {
  270. if (pages[index].route === 'plugins/clerk/order/order') {
  271. idx = index
  272. }
  273. });
  274. if (idx > -1) {
  275. pages[idx]._num = 1;
  276. uni.navigateBack({
  277. delta: pages.length - 1 - idx
  278. });
  279. } else {
  280. uni.redirectTo({
  281. url: '/plugins/clerk/order/order?status=1&type=1'
  282. })
  283. }
  284. } else {
  285. uni.redirectTo({
  286. url: '/pages/index/index'
  287. })
  288. }
  289. } else {
  290. this.msg = '';
  291. }
  292. },
  293. },
  294. onLoad(options) { this.$commonLoad.onload(options);
  295. let that = this;
  296. that.id = options.id;
  297. var getUser = setInterval(() => {
  298. if(that.userInfo) {
  299. that.IsClerk();
  300. clearInterval(getUser);
  301. }
  302. },500)
  303. }
  304. }
  305. </script>
  306. <style lang="scss" scoped>
  307. .info-title {
  308. font-size: #{24rpx};
  309. color: #353535;
  310. margin-bottom: #{20rpx};
  311. }
  312. .bg {
  313. position: fixed;
  314. top: 0;
  315. left: 0;
  316. width: 100%;
  317. height: 100%;
  318. background-color: rgba(0, 0, 0, .3);
  319. z-index: 1000;
  320. .dialog {
  321. margin-top: #{-100rpx};
  322. width: #{630rpx};
  323. background-color: #fff;
  324. padding-top: #{40rpx};
  325. border-radius: #{16rpx};
  326. font-size: #{32rpx};
  327. color: #353535;
  328. text-align: center;
  329. .dialog-content {
  330. margin: #{40rpx};
  331. }
  332. .dialog-btn {
  333. color: #ff4544;
  334. height: #{88rpx};
  335. line-height: #{88rpx};
  336. border-top: #{1rpx} solid #e2e2e2;
  337. }
  338. }
  339. .remark-dialog {
  340. margin-top: #{-100rpx};
  341. padding-top: #{32rpx};
  342. background-color: #fff;
  343. border-radius: #{16rpx};
  344. font-size: #{32rpx};
  345. color: #353535;
  346. .title {
  347. text-align: center;
  348. font-size: #{32rpx};
  349. margin-top: #{8rpx};
  350. margin-bottom: #{32rpx};
  351. }
  352. .textarea {
  353. width: #{556rpx};
  354. height: #{300rpx};
  355. border: #{1rpx} solid #e2e2e2;
  356. border-radius: #{16rpx};
  357. padding: #{24rpx} #{32rpx};
  358. margin: 0 #{32rpx};
  359. }
  360. .bottom-box {
  361. height: #{88rpx};
  362. border-top: #{1rpx} solid #e2e2e2;
  363. margin-top: #{32rpx};
  364. padding: #{20rpx} 0;
  365. .cancel-text {
  366. font-size: 34#{rpx};
  367. color: #666666;
  368. width: 0;
  369. }
  370. .clerk-text {
  371. font-size: 34#{rpx};
  372. color: #ff4544;
  373. width: 0;
  374. border-left: #{1rpx} solid #e2e2e2;
  375. }
  376. }
  377. }
  378. }
  379. .clerk-box {
  380. position: absolute;
  381. width: 100%;
  382. height: 100%;
  383. }
  384. .remark-box {
  385. margin-top: 14#{rpx};
  386. }
  387. .action-box {
  388. position: fixed;
  389. background-color: #fff;
  390. height: 140#{rpx};
  391. padding:30#{rpx};
  392. bottom: 0;
  393. width: 100%;
  394. z-index: 999;
  395. .btn {
  396. background-color: $uni-important-color-red;
  397. color: #fff;
  398. z-index: 999;
  399. width: 100%;
  400. font-size: 32#{rpx};
  401. height: 88#{rpx};
  402. line-height: 88#{rpx};
  403. border-radius: 44#{rpx};
  404. }
  405. .btn::after {
  406. border: 0;
  407. }
  408. .clerk-text {
  409. font-size: $uni-font-size-import-one;
  410. height: 100%;
  411. color: $uni-general-color-one;
  412. }
  413. .left-box {
  414. margin-right: 20#{rpx};
  415. .edit-icon {
  416. width: 30#{rpx};
  417. height: 30#{rpx};
  418. margin-bottom: 10#{rpx};
  419. }
  420. .edit-remark {
  421. font-size: 28#{rpx};
  422. color: $uni-general-color-two;
  423. }
  424. }
  425. }
  426. .order-info {
  427. width: 702#{rpx};
  428. margin: 24#{rpx};
  429. background-color: #fff;
  430. border-radius: 16#{rpx};
  431. padding: 24#{rpx};
  432. font-size: $uni-font-size-general-one;
  433. color: $uni-important-color-black;
  434. }
  435. .order-info.form-data {
  436. margin-bottom: #{24rpx};
  437. }
  438. .line {
  439. height: 1#{rpx};
  440. width: 654#{rpx};
  441. background-color: $uni-weak-color-one;
  442. margin: 22#{rpx} 0;
  443. }
  444. .info-label {
  445. color: $uni-general-color-two;
  446. }
  447. .goods-box {
  448. width: 702#{rpx};
  449. margin: 0 24#{rpx};
  450. background-color: #fff;
  451. border-radius: 16#{rpx};
  452. padding: 24#{rpx};
  453. font-size: 28#{rpx};
  454. color: $uni-important-color-black;
  455. }
  456. .order-price-box {
  457. border-top: 1#{rpx} solid #e2e2e2;
  458. margin-top: 24#{rpx};
  459. padding: 20#{rpx} 0 6#{rpx};
  460. font-size: 28#{rpx};
  461. color: $uni-important-color-black;
  462. border-bottom-left-radius: 16#{rpx};
  463. border-bottom-right-radius: 16#{rpx};
  464. background-color: #fff;
  465. }
  466. .order-price-box .price {
  467. font-size: 28#{rpx};
  468. color: $uni-important-color-red;
  469. }
  470. .bg {
  471. position: fixed;
  472. top: 0;
  473. left: 0;
  474. width: 100%;
  475. height: 100%;
  476. background-color: rgba(0, 0, 0, .3);
  477. z-index: 1000;
  478. }
  479. .dialog {
  480. width: 630#{rpx};
  481. background-color: #fff;
  482. padding-top: 40#{rpx};
  483. border-radius: 16#{rpx};
  484. font-size: 32#{rpx};
  485. color: $uni-important-color-black;
  486. text-align: center;
  487. }
  488. .dialog-content {
  489. margin: 40#{rpx};
  490. }
  491. .dialog-btn {
  492. color: $uni-important-color-red;
  493. height: 88#{rpx};
  494. line-height: 88#{rpx};
  495. border-top: 1#{rpx} solid $uni-weak-color-one;
  496. .view1 {
  497. color: $uni-important-color-black;
  498. width: 50%;
  499. }
  500. .view2 {
  501. height: 45#{rpx};
  502. width: 1#{rpx};
  503. background-color: $uni-weak-color-one;
  504. }
  505. .view3 {
  506. width: 50%;
  507. }
  508. }
  509. </style>