index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <template>
  2. <view>
  3. <view class="OrderCancellation">
  4. <view class="header"></view>
  5. <view class="whiteBg" v-if="tabOn == 2">
  6. <view class="input">
  7. <input type="number" placeholder="请输入核销码" v-model="verify_code" />
  8. </view>
  9. <view class="bnt" @click="codeChange">
  10. <text class="iconfont icon-sousuo7"></text>
  11. </view>
  12. </view>
  13. <view v-if="tabOn == 1" class="scan" @click="scanCode">
  14. <text class="iconfont icon-ic_Scan"></text>
  15. </view>
  16. <view class="tabbar-box acea-row">
  17. <view class="item" :class="{ on: tabOn == 1 }" @click="onTab(1)">
  18. <view class="bg"></view>
  19. <view class="inner"><text class="iconfont icon-ic_Scan"></text>扫码核销</view>
  20. </view>
  21. <view class="item" :class="{ on: tabOn == 2 }" @click="onTab(2)">
  22. <view class="bg"></view>
  23. <view class="inner"><text class="iconfont icon-ic_edit"></text>手动输入</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import {
  31. orderGetVerfication
  32. } from "@/api/work";
  33. import colors from '@/mixins/color.js';
  34. import {
  35. toLogin
  36. } from '@/libs/login.js';
  37. import {
  38. mapGetters
  39. } from 'vuex';
  40. // #ifdef MP || APP-PLUS
  41. import NavBar from '../components/NavBar.vue';
  42. // #endif
  43. const app = getApp();
  44. export default {
  45. components: {
  46. // #ifdef MP || APP-PLUS
  47. NavBar,
  48. // #endif
  49. },
  50. // mixins: [colors],
  51. data() {
  52. return {
  53. theme: app.globalData.theme,
  54. // #ifdef MP || APP-PLUS
  55. iconColor: '#FFFFFF',
  56. isScrolling: false,
  57. // #endif
  58. iShidden: false,
  59. verify_code: '',
  60. isWeixin: '',
  61. orderInfo: {},
  62. tabOn: 1,
  63. auth: 1,
  64. }
  65. },
  66. computed: mapGetters(['isLogin']),
  67. onLoad(options) {
  68. // #ifdef H5 || APP-PLUS
  69. this.isWeixin = this.$wechat.isWeixin();
  70. // #endif
  71. // #ifdef MP
  72. if (options.scene) {
  73. options = this.$util.getUrlParams(decodeURIComponent(options.scene));
  74. }
  75. // #endif
  76. const {
  77. auth,
  78. code
  79. } = options;
  80. this.auth = auth || 1;
  81. this.verify_code = code || '';
  82. },
  83. onShow() {
  84. if (this.isLogin) {
  85. if (this.auth == 3) {
  86. this.codeChange();
  87. }
  88. } else {
  89. toLogin();
  90. }
  91. },
  92. methods: {
  93. // 立即核销
  94. codeChange: function() {
  95. let self = this
  96. let ref = /^[0-9]*$/;
  97. if (!this.verify_code) return self.$util.Tips({
  98. title: '请输入核销码'
  99. });
  100. orderGetVerfication({
  101. verifyCode: this.verify_code
  102. }).then(res => {
  103. if (res.code ==200) {
  104. uni.navigateTo({
  105. url: `/pages/admin/cancel/list?info=${JSON.stringify(res.data)}&verifyCode=${this.verify_code}`
  106. })
  107. }
  108. }).catch(res=>{
  109. uni.navigateTo({
  110. url:'/pages/admin/cancel/result?type=0'
  111. })
  112. })
  113. },
  114. // 扫码核
  115. scanCode() {
  116. var self = this;
  117. // #ifdef MP || APP
  118. uni.scanCode({
  119. success(res) {
  120. self.verify_code = res.result;
  121. self.codeChange();
  122. }
  123. })
  124. // #endif
  125. //#ifdef H5
  126. if(this.$wechat.isWeixin()){
  127. this.$wechat.wechatEvevt('scanQRCode', {
  128. needResult: 1,
  129. scanType: ["qrCode", "barCode"]
  130. }).then(res => {
  131. let result = res.resultStr;
  132. if (result.includes(',')) {
  133. result = result.split(",")[1]
  134. }
  135. this.verify_code = result
  136. this.codeChange();
  137. })
  138. }else{
  139. return self.$util.Tips({
  140. title: '扫码核销仅支持小程序/公众号/APP',
  141. endtime:2000,
  142. });
  143. }
  144. //#endif
  145. },
  146. cancel: function() {
  147. this.iShidden = false
  148. },
  149. onTab(value) {
  150. this.tabOn = value;
  151. }
  152. }
  153. }
  154. </script>
  155. <style lang="scss">
  156. page {
  157. // background-color: #fff;
  158. }
  159. .OrderCancellation {
  160. position: absolute;
  161. width: 100%;
  162. overflow: hidden;
  163. }
  164. .OrderCancellation .header {
  165. position: absolute;
  166. top: 0;
  167. left: -25%;
  168. width: 150%;
  169. height: 660rpx;
  170. border-bottom-right-radius: 100%;
  171. border-bottom-left-radius: 100%;
  172. background: #FFFFFF;
  173. }
  174. .OrderCancellation {
  175. // width: 100%;
  176. // height: 100%;
  177. // background: #fff;
  178. overflow: hidden;
  179. }
  180. .OrderCancellation .whiteBg {
  181. position: relative;
  182. width: 540rpx;
  183. height: 120rpx;
  184. border-radius: 60rpx;
  185. margin: 250rpx auto 416rpx;
  186. background: #F5F5F5;
  187. }
  188. .OrderCancellation .whiteBg .input {
  189. height: 100%;
  190. }
  191. .OrderCancellation .whiteBg .input input {
  192. font-size: 32rpx;
  193. color: #333333;
  194. height: 100%;
  195. text-align: center;
  196. line-height: 120rpx;
  197. padding: 0 104rpx;
  198. box-sizing: border-box;
  199. }
  200. .OrderCancellation .whiteBg .input .input-placeholder {
  201. color: #CCCCCC;
  202. }
  203. .OrderCancellation .whiteBg .bnt {
  204. position: absolute;
  205. top: 20rpx;
  206. right: 24rpx;
  207. width: 80rpx;
  208. height: 80rpx;
  209. border-radius: 40rpx;
  210. background: #2A7EFB;
  211. text-align: center;
  212. line-height: 80rpx;
  213. }
  214. .OrderCancellation .whiteBg .bnt .iconfont {
  215. font-size: 32rpx;
  216. color: #FFFFFF;
  217. }
  218. .OrderCancellation .scan {
  219. position: relative;
  220. width: 400rpx;
  221. height: 400rpx;
  222. border-radius: 200rpx;
  223. margin: 110rpx auto 0;
  224. background: #2A7EFB;
  225. box-shadow: 0rpx 4rpx 32rpx 0rpx rgba(27, 102, 214, 0.3);
  226. text-align: center;
  227. line-height: 400rpx;
  228. }
  229. .OrderCancellation .scan .iconfont {
  230. font-size: 120rpx;
  231. color: #FFFFFF;
  232. }
  233. .OrderCancellation .scan image {
  234. width: 100%;
  235. height: 100%;
  236. display: block;
  237. }
  238. .WriteOff {
  239. width: 560rpx;
  240. height: 800rpx;
  241. background-color: #fff;
  242. border-radius: 20rpx;
  243. position: fixed;
  244. top: 50%;
  245. left: 50%;
  246. margin-top: -400rpx;
  247. margin-left: -280rpx;
  248. z-index: 99;
  249. padding-top: 55rpx;
  250. }
  251. .WriteOff .pictrue {
  252. width: 340rpx;
  253. height: 340rpx;
  254. margin: 0 auto;
  255. }
  256. .WriteOff .pictrue image {
  257. width: 100%;
  258. height: 100%;
  259. display: block;
  260. border-radius: 10rpx;
  261. }
  262. .WriteOff .num {
  263. font-size: 30rpx;
  264. color: #666;
  265. margin: 28rpx 0 30rpx 0;
  266. }
  267. .WriteOff .num .see {
  268. font-size: 16rpx;
  269. color: #fff;
  270. border-radius: 4rpx;
  271. background-color: #c68937;
  272. padding-left: 5rpx;
  273. margin-left: 12rpx;
  274. }
  275. .WriteOff .num .see .iconfont {
  276. font-size: 15rpx;
  277. }
  278. .WriteOff .tip {
  279. font-size: 36rpx;
  280. color: #282828;
  281. text-align: center;
  282. border-top: 1px dashed #ccc;
  283. padding-top: 40rpx;
  284. position: relative;
  285. }
  286. .WriteOff .tip:after {
  287. content: "";
  288. position: absolute;
  289. width: 25rpx;
  290. height: 25rpx;
  291. border-radius: 50%;
  292. background-color: #7f7f7f;
  293. right: -12.5rpx;
  294. top: -12.5rpx;
  295. }
  296. .WriteOff .tip:before {
  297. content: "";
  298. position: absolute;
  299. width: 25rpx;
  300. height: 25rpx;
  301. border-radius: 50%;
  302. background-color: #7f7f7f;
  303. left: -12.5rpx;
  304. top: -12.5rpx;
  305. }
  306. .WriteOff .sure {
  307. font-size: 32rpx;
  308. color: #fff;
  309. text-align: center;
  310. line-height: 82rpx;
  311. height: 82rpx;
  312. width: 460rpx;
  313. border-radius: 41rpx;
  314. margin: 40rpx auto 0 auto;
  315. background-image: linear-gradient(to right, #f67a38 0%, #f11b09 100%);
  316. background-image: -webkit-linear-gradient(to right, #f67a38 0%, #f11b09 100%);
  317. background-image: -moz-linear-gradient(to right, #f67a38 0%, #f11b09 100%);
  318. background-color: var(--view-theme);
  319. }
  320. .WriteOff .cancel {
  321. line-height: 82rpx;
  322. color: #999;
  323. height: 82rpx;
  324. width: 460rpx;
  325. border-radius: 41rpx;
  326. margin: 10rpx auto 0 auto;
  327. text-align: center;
  328. }
  329. .WriteOff .cancel {}
  330. .views {
  331. font-size: 18rpx;
  332. background: #C68937;
  333. border-radius: 4px;
  334. color: #fff;
  335. padding: 5rpx 2rpx 5rpx 8rpx;
  336. margin-left: 10rpx;
  337. }
  338. .views-jian {
  339. font-size: 10px;
  340. }
  341. .tabbar-box {
  342. width: 516rpx;
  343. margin: 276rpx auto 0;
  344. .item {
  345. position: relative;
  346. flex: 1;
  347. z-index: 5;
  348. min-width: 0;
  349. height: 80rpx;
  350. border-radius: 40rpx 0 0 40rpx;
  351. overflow: hidden;
  352. &:last-child {
  353. border-radius: 0 40rpx 40rpx 0;
  354. .bg {
  355. height: 68rpx;
  356. top: 0;
  357. border-radius: 12rpx 0 0 12rpx;
  358. transform-origin: center top;
  359. transform: perspective(80rpx) rotateX(10deg) translateX(20rpx);
  360. }
  361. }
  362. &.on {
  363. .bg {
  364. background: #2A7EFB;
  365. }
  366. .inner {
  367. color: #FFFFFF;
  368. }
  369. }
  370. }
  371. .bg {
  372. position: absolute;
  373. bottom: 0;
  374. z-index: 2;
  375. width: 100%;
  376. height: 68rpx;
  377. border-radius: 0 12rpx 12rpx 0;
  378. background: #FFFFFF;
  379. transform-origin: center bottom;
  380. transform: perspective(80rpx) rotateX(-10deg) translateX(-20rpx);
  381. }
  382. .inner {
  383. position: absolute;
  384. z-index: 3;
  385. width: 260rpx;
  386. height: 80rpx;
  387. text-align: center;
  388. line-height: 80rpx;
  389. font-weight: 500;
  390. font-size: 28rpx;
  391. color: #333333;
  392. }
  393. .iconfont {
  394. vertical-align: middle;
  395. margin-right: 16rpx;
  396. font-size: 32rpx;
  397. }
  398. }
  399. </style>