clerk.vue 15 KB

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