index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="OrderCancellation">
  4. <view class="header"></view>
  5. <view class="input-box acea-row row-middle">
  6. <view class="input-area acea-row row-center">
  7. <view class="whiteBg" v-if="tabOn == 2">
  8. <view class="input">
  9. <input type="number" placeholder="请输入" v-model="verify_code" @focus="onFocus" />
  10. </view>
  11. <view class="bnt" @click="codeChange">
  12. <text class="iconfont icon-ic_search"></text>
  13. </view>
  14. </view>
  15. <view v-if="tabOn == 1" class="scan" @click="scanCode">
  16. <text class="iconfont icon-ic_Scan"></text>
  17. </view>
  18. <view class="tips" v-if="tips">
  19. <text class="iconfont icon-icon_tip"></text>
  20. {{ tips }}
  21. </view>
  22. </view>
  23. </view>
  24. <view class="tabbar-box acea-row">
  25. <view class="item" :class="{ on: tabOn == 1 }" @click="onTab(1)">
  26. <view class="bg"></view>
  27. <view class="inner"><text class="iconfont icon-ic_Scan"></text>扫码核销</view>
  28. </view>
  29. <view class="item" :class="{ on: tabOn == 2 }" @click="onTab(2)">
  30. <view class="bg"></view>
  31. <view class="inner"><text class="iconfont icon-ic_edit"></text>手动输入</view>
  32. </view>
  33. </view>
  34. </view>
  35. <view v-if="iShidden">
  36. <view class="WriteOff">
  37. <view class="pictrue">
  38. <image :src="orderInfo.image" />
  39. </view>
  40. <view class="num acea-row row-center-wrapper">
  41. <text>{{ orderInfo.order_id }}</text>
  42. <view class="views" @click='goOrderDetails(orderInfo.order_id,orderInfo.order_type)'>查看<text class='iconfont icon-jiantou views-jian'></text></view>
  43. </view>
  44. <view class="tip">确定要核销此订单吗?</view>
  45. <view class="sure" @click="confirm">确定核销</view>
  46. <view class=" cancel" @click="cancel">取消</view>
  47. </view>
  48. <view class="mask"></view>
  49. </view>
  50. <home v-if="navigation"></home>
  51. </view>
  52. </template>
  53. <script>
  54. import {
  55. orderVerific
  56. } from "@/api/admin";
  57. import home from '../components/home/index.vue';
  58. import colors from '@/mixins/color.js';
  59. import {
  60. toLogin
  61. } from '@/libs/login.js';
  62. import {
  63. mapGetters
  64. } from 'vuex';
  65. export default {
  66. components: {
  67. home
  68. },
  69. mixins: [colors],
  70. data() {
  71. return {
  72. iShidden: false,
  73. verify_code: '',
  74. isWeixin: '',
  75. orderInfo: {},
  76. tabOn: 1,
  77. auth: 1,
  78. tips: '',
  79. }
  80. },
  81. computed: mapGetters(['isLogin', 'storeNum']),
  82. onLoad(options) {
  83. // #ifdef H5 || APP-PLUS
  84. this.isWeixin = this.$wechat.isWeixin();
  85. // #endif
  86. // #ifdef MP
  87. if (options.scene) {
  88. options = this.$util.getUrlParams(decodeURIComponent(options.scene));
  89. }
  90. // #endif
  91. const {
  92. auth,
  93. code
  94. } = options;
  95. this.auth = auth || 1;
  96. this.verify_code = code || '';
  97. },
  98. onShow() {
  99. if (this.isLogin) {
  100. if (this.auth == 3) {
  101. this.codeChange();
  102. }
  103. } else {
  104. toLogin();
  105. }
  106. },
  107. methods: {
  108. /**
  109. * 去订单详情
  110. */
  111. goOrderDetails: function(id, type) {
  112. if (type == 'integral') {
  113. uni.navigateTo({
  114. url: '/pages/points_mall/integral_order_details?order_id=' + id
  115. });
  116. } else {
  117. uni.navigateTo({
  118. url: '/pages/admin/orderDetail/index?id=' + id + '&goname=look&storeNum=' + this.storeNum
  119. });
  120. }
  121. },
  122. // 立即核销
  123. codeChange: function() {
  124. let self = this
  125. let ref = /^[0-9]*$/;
  126. // if (!this.verify_code) return self.$util.Tips({
  127. // title: '请输入核销码'
  128. // });
  129. // if (!ref.test(this.verify_code)) return self.$util.Tips({
  130. // title: '请输入正确的核销码'
  131. // });
  132. if (!this.verify_code) {
  133. this.tips = '请输入核销码'
  134. return
  135. };
  136. if (!ref.test(this.verify_code)) {
  137. this.tips = '请输入正确的核销码'
  138. return
  139. };
  140. self.$util.Tips({
  141. title: '查询中'
  142. });
  143. setTimeout(() => {
  144. orderVerific(this.verify_code, this.auth)
  145. .then(res => {
  146. let auth = res.data.auth;
  147. self.orderInfo = res.data
  148. // self.iShidden = true
  149. if (res.data.is_order_code) {
  150. if (res.data.product_type) {
  151. uni.navigateTo({
  152. url: '/pages/admin/writeOffCard/index?id=' + res.data.data[0].id + '&storeNum=' + this.storeNum
  153. })
  154. } else {
  155. if (res.data.data[0].status == 2) {
  156. uni.navigateTo({
  157. url: '/pages/admin/offOrderResult/index?id=' + res.data.data[0].order_id + '&storeNum=' + this.storeNum
  158. })
  159. } else {
  160. uni.navigateTo({
  161. url: '/pages/admin/distribution/scanning/detail/index?auth=' + auth + '&id=' + res.data.data[0].id + '&let=' + res.data.data.length +
  162. '&code=' +
  163. this
  164. .verify_code + '&storeNum=' + this.storeNum
  165. })
  166. }
  167. }
  168. } else {
  169. if (res.data.product_type) {
  170. } else {
  171. if (res.data.data.length) {
  172. // 跳转多订单核销页
  173. uni.navigateTo({
  174. url: '/pages/admin/distribution/scanning/index?auth=' + auth + '&code=' + this.verify_code
  175. })
  176. } else {
  177. // 跳转结果页
  178. uni.navigateTo({
  179. url: '/pages/admin/offOrderResult/index&storeNum=' + this.storeNum
  180. })
  181. }
  182. }
  183. }
  184. })
  185. .catch(res => {
  186. self.verify_code = ''
  187. self.tips = res
  188. // return self.$util.Tips({
  189. // title: res
  190. // });
  191. });
  192. }, 800);
  193. },
  194. // 扫码核
  195. scanCode() {
  196. var self = this;
  197. self.tips = '';
  198. // #ifdef MP || APP
  199. uni.scanCode({
  200. success(res) {
  201. self.verify_code = res.result || '';
  202. if (res.path) {
  203. let path = decodeURIComponent(res.path);
  204. self.verify_code = path.split('code=')[1];
  205. }
  206. self.codeChange();
  207. },
  208. })
  209. // #endif
  210. //#ifdef H5
  211. this.$wechat.wechatEvevt('scanQRCode', {
  212. needResult: 1,
  213. scanType: ["qrCode", "barCode"]
  214. }).then(res => {
  215. let result = res.resultStr;
  216. if (result.includes(',')) {
  217. result = result.split(",")[1]
  218. }
  219. this.verify_code = result
  220. this.codeChange();
  221. });
  222. //#endif
  223. },
  224. /**
  225. * 确定销码
  226. */
  227. confirm: function() {
  228. let self = this
  229. orderVerific(this.verify_code, 1)
  230. .then(res => {
  231. self.verify_code = ''
  232. self.iShidden = false
  233. self.$util.Tips({
  234. title: res.msg
  235. });
  236. })
  237. .catch(res => {
  238. self.$util.Tips({
  239. title: res
  240. });
  241. });
  242. },
  243. /**
  244. * 取消
  245. */
  246. cancel: function() {
  247. this.iShidden = false
  248. },
  249. onTab(value) {
  250. this.tabOn = value;
  251. this.tips = '';
  252. },
  253. onFocus() {
  254. this.tips = '';
  255. }
  256. }
  257. }
  258. </script>
  259. <style lang="scss">
  260. page {
  261. // background-color: #fff;
  262. }
  263. .OrderCancellation {
  264. position: absolute;
  265. width: 100%;
  266. overflow: hidden;
  267. }
  268. .OrderCancellation .header {
  269. position: absolute;
  270. top: 0;
  271. left: -25%;
  272. width: 150%;
  273. height: 660rpx;
  274. border-bottom-right-radius: 100%;
  275. border-bottom-left-radius: 100%;
  276. background: #FFFFFF;
  277. }
  278. .OrderCancellation {
  279. // width: 100%;
  280. // height: 100%;
  281. // background: #fff;
  282. overflow: hidden;
  283. }
  284. .OrderCancellation .whiteBg {
  285. position: relative;
  286. width: 540rpx;
  287. height: 120rpx;
  288. border-radius: 60rpx;
  289. // margin: 250rpx auto 416rpx;
  290. background: #F5F5F5;
  291. }
  292. .OrderCancellation .whiteBg .input {
  293. height: 100%;
  294. }
  295. .OrderCancellation .whiteBg .input input {
  296. font-size: 32rpx;
  297. color: #333333;
  298. height: 100%;
  299. text-align: center;
  300. line-height: 120rpx;
  301. padding: 0 104rpx;
  302. box-sizing: border-box;
  303. }
  304. .OrderCancellation .whiteBg .input .input-placeholder {
  305. color: #CCCCCC;
  306. }
  307. .OrderCancellation .whiteBg .bnt {
  308. position: absolute;
  309. top: 20rpx;
  310. right: 24rpx;
  311. width: 80rpx;
  312. height: 80rpx;
  313. border-radius: 40rpx;
  314. background: #2A7EFB;
  315. text-align: center;
  316. line-height: 80rpx;
  317. }
  318. .OrderCancellation .whiteBg .bnt .iconfont {
  319. font-size: 32rpx;
  320. color: #FFFFFF;
  321. }
  322. .OrderCancellation .scan {
  323. // position: relative;
  324. width: 400rpx;
  325. height: 400rpx;
  326. border-radius: 200rpx;
  327. // margin: 110rpx auto 0;
  328. background: #2A7EFB;
  329. box-shadow: 0rpx 4rpx 32rpx 0rpx rgba(27, 102, 214, 0.3);
  330. text-align: center;
  331. line-height: 400rpx;
  332. }
  333. .OrderCancellation .scan .iconfont {
  334. font-size: 120rpx;
  335. color: #FFFFFF;
  336. }
  337. .OrderCancellation .scan image {
  338. width: 100%;
  339. height: 100%;
  340. display: block;
  341. }
  342. .WriteOff {
  343. width: 560rpx;
  344. height: 800rpx;
  345. background-color: #fff;
  346. border-radius: 20rpx;
  347. position: fixed;
  348. top: 50%;
  349. left: 50%;
  350. margin-top: -400rpx;
  351. margin-left: -280rpx;
  352. z-index: 99;
  353. padding-top: 55rpx;
  354. }
  355. .WriteOff .pictrue {
  356. width: 340rpx;
  357. height: 340rpx;
  358. margin: 0 auto;
  359. }
  360. .WriteOff .pictrue image {
  361. width: 100%;
  362. height: 100%;
  363. display: block;
  364. border-radius: 10rpx;
  365. }
  366. .WriteOff .num {
  367. font-size: 30rpx;
  368. color: #666;
  369. margin: 28rpx 0 30rpx 0;
  370. }
  371. .WriteOff .num .see {
  372. font-size: 16rpx;
  373. color: #fff;
  374. border-radius: 4rpx;
  375. background-color: #c68937;
  376. padding-left: 5rpx;
  377. margin-left: 12rpx;
  378. }
  379. .WriteOff .num .see .iconfont {
  380. font-size: 15rpx;
  381. }
  382. .WriteOff .tip {
  383. font-size: 36rpx;
  384. color: #282828;
  385. text-align: center;
  386. border-top: 1px dashed #ccc;
  387. padding-top: 40rpx;
  388. position: relative;
  389. }
  390. .WriteOff .tip:after {
  391. content: "";
  392. position: absolute;
  393. width: 25rpx;
  394. height: 25rpx;
  395. border-radius: 50%;
  396. background-color: #7f7f7f;
  397. right: -12.5rpx;
  398. top: -12.5rpx;
  399. }
  400. .WriteOff .tip:before {
  401. content: "";
  402. position: absolute;
  403. width: 25rpx;
  404. height: 25rpx;
  405. border-radius: 50%;
  406. background-color: #7f7f7f;
  407. left: -12.5rpx;
  408. top: -12.5rpx;
  409. }
  410. .WriteOff .sure {
  411. font-size: 32rpx;
  412. color: #fff;
  413. text-align: center;
  414. line-height: 82rpx;
  415. height: 82rpx;
  416. width: 460rpx;
  417. border-radius: 41rpx;
  418. margin: 40rpx auto 0 auto;
  419. background-image: linear-gradient(to right, #f67a38 0%, #f11b09 100%);
  420. background-image: -webkit-linear-gradient(to right, #f67a38 0%, #f11b09 100%);
  421. background-image: -moz-linear-gradient(to right, #f67a38 0%, #f11b09 100%);
  422. background-color: var(--view-theme);
  423. }
  424. .WriteOff .cancel {
  425. line-height: 82rpx;
  426. color: #999;
  427. height: 82rpx;
  428. width: 460rpx;
  429. border-radius: 41rpx;
  430. margin: 10rpx auto 0 auto;
  431. text-align: center;
  432. }
  433. .WriteOff .cancel {}
  434. .views {
  435. font-size: 18rpx;
  436. background: #C68937;
  437. border-radius: 4px;
  438. color: #fff;
  439. padding: 5rpx 2rpx 5rpx 8rpx;
  440. margin-left: 10rpx;
  441. }
  442. .views-jian {
  443. font-size: 10px;
  444. }
  445. .tabbar-box {
  446. width: 516rpx;
  447. margin: 126rpx auto 0;
  448. .item {
  449. position: relative;
  450. flex: 1;
  451. z-index: 5;
  452. min-width: 0;
  453. height: 80rpx;
  454. border-radius: 40rpx 0 0 40rpx;
  455. overflow: hidden;
  456. &:last-child {
  457. border-radius: 0 40rpx 40rpx 0;
  458. .bg {
  459. height: 68rpx;
  460. top: 0;
  461. border-radius: 12rpx 0 0 12rpx;
  462. transform-origin: center top;
  463. transform: perspective(80rpx) rotateX(10deg) translateX(20rpx);
  464. }
  465. }
  466. &.on {
  467. .bg {
  468. background: #2A7EFB;
  469. }
  470. .inner {
  471. color: #FFFFFF;
  472. }
  473. }
  474. }
  475. .bg {
  476. position: absolute;
  477. bottom: 0;
  478. z-index: 2;
  479. width: 100%;
  480. height: 68rpx;
  481. border-radius: 0 12rpx 12rpx 0;
  482. background: #FFFFFF;
  483. transform-origin: center bottom;
  484. transform: perspective(80rpx) rotateX(-10deg) translateX(-20rpx);
  485. }
  486. .inner {
  487. position: absolute;
  488. z-index: 3;
  489. width: 260rpx;
  490. height: 80rpx;
  491. text-align: center;
  492. line-height: 80rpx;
  493. font-weight: 500;
  494. font-size: 28rpx;
  495. color: #333333;
  496. }
  497. .iconfont {
  498. vertical-align: middle;
  499. margin-right: 16rpx;
  500. font-size: 32rpx;
  501. }
  502. }
  503. .input-box {
  504. height: 660rpx;
  505. padding-bottom: 40rpx;
  506. }
  507. .input-area {
  508. flex: 1;
  509. position: relative;
  510. .tips {
  511. position: absolute;
  512. bottom: -52rpx;
  513. left: 0;
  514. width: 100%;
  515. transform: translateY(100%);
  516. text-align: center;
  517. font-size: 26rpx;
  518. line-height: 36rpx;
  519. color: #FF7E00;
  520. .iconfont {
  521. margin-right: 8rpx;
  522. font-size: 28rpx;
  523. }
  524. }
  525. .whiteBg + .tips {
  526. bottom: -48rpx;
  527. }
  528. }
  529. </style>