1
0

clerk.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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 dir-top-nowrap form-data">
  70. <app-form-data :detail="orderDetail.detail"></app-form-data>
  71. </view>
  72. <view style="height: 140rpx; width: 100%"></view>
  73. <view class='action-box'>
  74. <button v-if='orderDetail.is_pay == 1 && orderDetail.clerk_id == 0'
  75. @click='orderClerk'
  76. class='box-grow-0 btn'>
  77. 核销订单
  78. </button>
  79. <button v-if='orderDetail.is_pay == 0' class='box-grow-0 btn' @click='clerkAffirmPay'>确认收款</button>
  80. <view class="cross-center main-center clerk-text" v-else>订单已核销</view>
  81. </view>
  82. </view>
  83. <view v-if="msg" class='bg cross-center main-center'>
  84. <view class='dialog'>
  85. <view>提示</view>
  86. <view class='dialog-content'>无核销权限</view>
  87. <view @click='toIndex' class='dialog-btn'>确认</view>
  88. </view>
  89. </view>
  90. </app-layout>
  91. </template>
  92. <script>
  93. import { mapState } from 'vuex';
  94. import appOrderGoodsInfo from "../../../components/page-component/app-order-goods-info/app-order-goods-info.vue";
  95. import appFormData from "../../../components/basic-component/app-order/app-form-data.vue";
  96. export default {
  97. components: {
  98. 'app-order-goods-info': appOrderGoodsInfo,
  99. appFormData,
  100. },
  101. data() {
  102. return {
  103. id: null,
  104. orderDetail: {},
  105. clerk_remark: '',
  106. is_show: false,
  107. msg: false,
  108. }
  109. },
  110. computed: {
  111. ...mapState({
  112. userInfo: state => state.user.info,
  113. })
  114. },
  115. methods: {
  116. toIndex() {
  117. uni.redirectTo({
  118. url: '/pages/index/index'
  119. });
  120. },
  121. getOrderDetail() {
  122. this.$request({
  123. url: this.$api.order.detail,
  124. data: {
  125. id: this.id,
  126. action_type: 1
  127. }
  128. }).then(response => {
  129. this.$hideLoading();
  130. this.is_show = true;
  131. if (response.code === 0) {
  132. this.orderDetail = response.data.detail;
  133. }
  134. }).catch(() => {
  135. this.$hideLoading();
  136. });
  137. },
  138. IsClerk() {
  139. this.$showLoading();
  140. this.$request({
  141. url: this.$api.user.is_clerk,
  142. data: {
  143. clerk_id: this.userInfo.options.user_id,
  144. }
  145. }).then(response => {
  146. if (response.code === 0) {
  147. if(response.data.is_clerk_user == 1) {
  148. this.getOrderDetail();
  149. }else {
  150. this.$hideLoading();
  151. this.msg = true;
  152. }
  153. }
  154. }).catch(() => {
  155. this.$hideLoading();
  156. });
  157. },
  158. clerkAffirmPay() {
  159. let self = this;
  160. uni.showModal({
  161. title: '提示',
  162. content: '确认已进行线下收款?',
  163. success: function (res) {
  164. if (res.confirm) {
  165. uni.showLoading({
  166. title: '加载中'
  167. });
  168. self.$request({
  169. url: self.$api.order.clerk_affirm_pay,
  170. data: {
  171. id: self.id,
  172. action_type: 1,
  173. }
  174. }).then(response => {
  175. uni.hideLoading();
  176. if (response.code === 0) {
  177. self.getOrderDetail();
  178. } else {
  179. uni.showToast({
  180. title: response.msg,
  181. icon: 'none',
  182. });
  183. }
  184. this.msg = response.data.msg
  185. }).catch(() => {
  186. uni.hideLoading();
  187. });
  188. }
  189. }
  190. });
  191. },
  192. orderClerk() {
  193. let self = this;
  194. uni.showModal({
  195. content: '是否核销订单?',
  196. success: function (res) {
  197. if (res.confirm) {
  198. self.$showLoading();
  199. self.$request({
  200. url: self.$api.order.order_clerk,
  201. data: {
  202. id: self.id,
  203. action_type: 1,
  204. clerk_remark: self.clerk_remark
  205. }
  206. }).then(response => {
  207. self.$hideLoading();
  208. uni.showToast({
  209. title: response.msg,
  210. icon: 'none',
  211. duration: 2000,
  212. success: function() {
  213. if (response.code === 0) {
  214. setTimeout(()=> {
  215. uni.redirectTo({
  216. url: '/plugins/clerk/order/order?status=1&type=1'
  217. })
  218. }, 2000);
  219. }
  220. }
  221. })
  222. }).catch(() => {
  223. self.$hideLoading();
  224. });
  225. }
  226. }
  227. })
  228. },
  229. closeDialog() {
  230. if (this.msg == '核销成功') {
  231. this.msg = '';
  232. if (this.is_clerk) {
  233. let pages = getCurrentPages();
  234. let idx;
  235. pages.forEach((row, index) => {
  236. if (pages[index].route === 'plugins/clerk/order/order') {
  237. idx = index
  238. }
  239. });
  240. if (idx > -1) {
  241. pages[idx]._num = 1;
  242. uni.navigateBack({
  243. delta: pages.length - 1 - idx
  244. });
  245. } else {
  246. uni.redirectTo({
  247. url: '/plugins/clerk/order/order?status=1&type=1'
  248. })
  249. }
  250. } else {
  251. uni.redirectTo({
  252. url: '/pages/index/index'
  253. })
  254. }
  255. } else {
  256. this.msg = '';
  257. }
  258. },
  259. },
  260. onLoad(options) {
  261. let that = this;
  262. that.id = options.id;
  263. var getUser = setInterval(() => {
  264. if(that.userInfo) {
  265. that.IsClerk();
  266. clearInterval(getUser);
  267. }
  268. },500)
  269. }
  270. }
  271. </script>
  272. <style lang="scss" scoped>
  273. .bg {
  274. position: fixed;
  275. top: 0;
  276. left: 0;
  277. width: 100%;
  278. height: 100%;
  279. background-color: rgba(0, 0, 0, .3);
  280. z-index: 1000;
  281. .dialog {
  282. margin-top: #{-100rpx};
  283. width: #{630rpx};
  284. background-color: #fff;
  285. padding-top: #{40rpx};
  286. border-radius: #{16rpx};
  287. font-size: #{32rpx};
  288. color: #353535;
  289. text-align: center;
  290. .dialog-content {
  291. margin: #{40rpx};
  292. }
  293. .dialog-btn {
  294. color: #ff4544;
  295. height: #{88rpx};
  296. line-height: #{88rpx};
  297. border-top: #{1rpx} solid #e2e2e2;
  298. }
  299. }
  300. }
  301. .clerk-box {
  302. position: absolute;
  303. width: 100%;
  304. height: 100%;
  305. }
  306. .remark-box {
  307. margin-top: 14#{rpx};
  308. }
  309. .action-box {
  310. position: fixed;
  311. background-color: #fff;
  312. height: 140#{rpx};
  313. bottom: 0;
  314. width: 100%;
  315. z-index: 999;
  316. .btn {
  317. background-color: $uni-important-color-red;
  318. color: #fff;
  319. z-index: 999;
  320. width: 702#{rpx};
  321. margin-top: 26#{rpx};
  322. font-size: 32#{rpx};
  323. height: 88#{rpx};
  324. line-height: 88#{rpx};
  325. border-radius: 44#{rpx};
  326. }
  327. .btn::after {
  328. border: 0;
  329. }
  330. .clerk-text {
  331. font-size: $uni-font-size-import-one;
  332. height: 100%;
  333. color: $uni-general-color-one;
  334. }
  335. }
  336. .order-info {
  337. width: 702#{rpx};
  338. margin: 24#{rpx};
  339. background-color: #fff;
  340. border-radius: 16#{rpx};
  341. padding: 24#{rpx};
  342. font-size: $uni-font-size-general-one;
  343. color: $uni-important-color-black;
  344. }
  345. .order-info.form-data {
  346. margin-bottom: #{24rpx};
  347. }
  348. .line {
  349. height: 1#{rpx};
  350. width: 654#{rpx};
  351. background-color: $uni-weak-color-one;
  352. margin: 22#{rpx} 0;
  353. }
  354. .info-label {
  355. color: $uni-general-color-two;
  356. }
  357. .goods-box {
  358. width: 702#{rpx};
  359. margin: 0 24#{rpx};
  360. background-color: #fff;
  361. border-radius: 16#{rpx};
  362. padding: 24#{rpx};
  363. font-size: 28#{rpx};
  364. color: $uni-important-color-black;
  365. }
  366. .order-price-box {
  367. border-top: 1#{rpx} solid #e2e2e2;
  368. margin-top: 24#{rpx};
  369. padding: 20#{rpx} 0 6#{rpx};
  370. font-size: 28#{rpx};
  371. color: $uni-important-color-black;
  372. border-bottom-left-radius: 16#{rpx};
  373. border-bottom-right-radius: 16#{rpx};
  374. background-color: #fff;
  375. }
  376. .order-price-box .price {
  377. font-size: 28#{rpx};
  378. color: $uni-important-color-red;
  379. }
  380. .bg {
  381. position: fixed;
  382. top: 0;
  383. left: 0;
  384. width: 100%;
  385. height: 100%;
  386. background-color: rgba(0, 0, 0, .3);
  387. z-index: 1000;
  388. }
  389. .dialog {
  390. width: 630#{rpx};
  391. background-color: #fff;
  392. padding-top: 40#{rpx};
  393. border-radius: 16#{rpx};
  394. font-size: 32#{rpx};
  395. color: $uni-important-color-black;
  396. text-align: center;
  397. }
  398. .dialog-content {
  399. margin: 40#{rpx};
  400. }
  401. .dialog-btn {
  402. color: $uni-important-color-red;
  403. height: 88#{rpx};
  404. line-height: 88#{rpx};
  405. border-top: 1#{rpx} solid $uni-weak-color-one;
  406. .view1 {
  407. color: $uni-important-color-black;
  408. width: 50%;
  409. }
  410. .view2 {
  411. height: 45#{rpx};
  412. width: 1#{rpx};
  413. background-color: $uni-weak-color-one;
  414. }
  415. .view3 {
  416. width: 50%;
  417. }
  418. }
  419. </style>