hexiao.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. <template>
  2. <view class="wipe-wrapper">
  3. <view class="wipe-top">
  4. <view class="top-left" @click="smsh">
  5. <image src="../../static/icon/sm.png" mode=""></image>
  6. <view class="">
  7. 扫码核销
  8. </view>
  9. </view>
  10. <view class="top-right" @click="srhx">
  11. <image src="../../static/icon/sr.png" mode=""></image>
  12. <view class="">
  13. 输入核销
  14. </view>
  15. </view>
  16. <view class="top-jg"></view>
  17. </view>
  18. <uni-popup ref="popuphx" class="agree-wrapper">
  19. <view class="hx-wrapper">
  20. <view class="hx-img">
  21. <image src="https://hy.liuniu946.com/app/img/hxbg.png" mode=""></image>
  22. </view>
  23. <view class="hx-body">
  24. <view class="hx-title">
  25. 输入核销码核销
  26. </view>
  27. <input type="text" v-model="code" placeholder="请输入核销码" placeholder-class="hx-placeholder" />
  28. <view class="hx-btn" @click="qhx">
  29. 立即核销
  30. </view>
  31. </view>
  32. <view class="hx-close" @click="close">
  33. <image src="../../static/icon/close.png" mode=""></image>
  34. </view>
  35. </view>
  36. </uni-popup>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. orderData,
  42. getUserInfo,
  43. getSpreadCount,
  44. bindAdmin,
  45. orderVerific,
  46. exchangeOrderVerific
  47. } from '@/api/user.js';
  48. import empty from '@/components/empty';
  49. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  50. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  51. export default {
  52. components: {
  53. empty,
  54. uniPopup
  55. },
  56. data() {
  57. return {
  58. height: '',
  59. code: '',
  60. limit: 10,
  61. page: 1,
  62. loadingType: 'more',
  63. loaded: '',
  64. };
  65. },
  66. onLoad() {
  67. this.loadData()
  68. },
  69. onReady(res) {
  70. var _this = this;
  71. },
  72. methods: {
  73. loadData() {
  74. let obj = this
  75. if (obj.loadingType == 'loading') {
  76. return
  77. }
  78. if (obj.loadingType == 'noMore') {
  79. return
  80. }
  81. },
  82. srhx() {
  83. this.$refs.popuphx.open()
  84. },
  85. close() {
  86. this.$refs.popuphx.close()
  87. },
  88. smsh() {
  89. let obj = this
  90. // #ifdef H5
  91. let wx = require('@/plugin/jweixin-module');
  92. wx.scanQRCode({
  93. needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
  94. scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
  95. success: function(res) {
  96. var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
  97. orderVerific({
  98. code:res.resultStr,
  99. }).then(res => {
  100. uni.showToast({
  101. title: '核销成功',
  102. duration: 2000
  103. });
  104. }).catch(err => {
  105. console.log('dddd')
  106. })
  107. }
  108. });
  109. // #endif
  110. // #ifndef H5
  111. uni.scanCode({
  112. success: (res) => {
  113. this.code = res.result
  114. this.srhx()
  115. }
  116. })
  117. // #endif
  118. },
  119. qhx() {
  120. if (this.code == '') {
  121. return this.$api.msg('请输入核销码')
  122. }
  123. uni.showLoading({
  124. title: '核销中...',
  125. mask: true
  126. })
  127. if (this.code.indexOf('ticket:') != -1) {
  128. exchangeOrderVerific({
  129. code: this.code,
  130. }).then(res => {
  131. uni.hideLoading()
  132. // this.$api.msg(res.msg)
  133. console.log(res, '++++++++++++++++++++++++++++++')
  134. this.$refs.popuphx.close()
  135. this.code = ''
  136. this.page = 1
  137. this.loadingType = 'more'
  138. this.goodList = []
  139. uni.showToast({
  140. title: '核销成功',
  141. duration: 2000
  142. });
  143. this.loadData()
  144. }).catch(err => {
  145. console.log('dddd')
  146. })
  147. } else {
  148. orderVerific({
  149. code: this.code,
  150. }).then(res => {
  151. uni.hideLoading()
  152. // this.$api.msg(res.msg)
  153. console.log(res, '++++++++++++++++++++++++++++++')
  154. this.$refs.popuphx.close()
  155. this.code = ''
  156. this.page = 1
  157. this.loadingType = 'more'
  158. this.goodList = []
  159. uni.showToast({
  160. title: '核销成功',
  161. duration: 2000
  162. });
  163. this.loadData()
  164. }).catch(err => {
  165. console.log('dddd')
  166. })
  167. }
  168. }
  169. }
  170. };
  171. </script>
  172. <style lang="scss" scoped>
  173. page {
  174. height: 100%;
  175. background-color: #f8f6f6;
  176. }
  177. .wipe-wrapper {
  178. .wipe-top {
  179. justify-content: space-around;
  180. width: 750rpx;
  181. box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
  182. font-size: 28rpx;
  183. font-weight: 500;
  184. color: #ef041f;
  185. line-height: 80rpx;
  186. text-align: center;
  187. position: relative;
  188. z-index: 10;
  189. .top-left {
  190. font-size: 32rpx;
  191. line-height: 120rpx;
  192. border-radius: 20rpx;
  193. background-color: #fff;
  194. height:420rpx;
  195. margin:5%;
  196. width:90%;
  197. vertical-align: middle;
  198. image {
  199. margin-top: 120rpx;
  200. width: 87rpx;
  201. height: 85rpx;
  202. margin-right: 10rpx;
  203. }
  204. }
  205. .top-right {
  206. font-size: 32rpx;
  207. border-radius: 20rpx;
  208. background-color: #fff;
  209. height:420rpx;
  210. vertical-align: middle;
  211. margin:5%;
  212. width:90%;
  213. image {
  214. margin-top: 120rpx;
  215. width: 87rpx;
  216. height: 85rpx;
  217. margin-right: 10rpx;
  218. }
  219. }
  220. .top-jg {
  221. width: 2rpx;
  222. height: 80rpx;
  223. background: #f0f0f0;
  224. position: absolute;
  225. // background: red;
  226. }
  227. }
  228. }
  229. .good-content {
  230. height: 100%;
  231. padding-top: 20rpx;
  232. }
  233. .good {
  234. width: 702rpx;
  235. // height: 304rpx;
  236. background: #ffffff;
  237. box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
  238. border-radius: 10rpx;
  239. padding: 0 30rpx;
  240. padding-bottom: 20rpx;
  241. margin: 0 auto 20rpx;
  242. position: relative;
  243. .goods-box-single {
  244. display: flex;
  245. padding: 20rpx 0;
  246. .goods-img {
  247. display: block;
  248. width: 120rpx;
  249. height: 120rpx;
  250. }
  251. .right {
  252. flex: 1;
  253. display: flex;
  254. flex-direction: column;
  255. padding: 0 30rpx 0 24rpx;
  256. overflow: hidden;
  257. .row {
  258. margin-top: 10rpx;
  259. justify-content: flex-end;
  260. }
  261. .row_title {
  262. padding: 5rpx 10rpx;
  263. background-color: #dddddd;
  264. border-radius: 10rpx;
  265. font-size: 22rpx;
  266. color: #ffffff;
  267. background: #ffeee9;
  268. border-radius: 5rpx;
  269. color: #f55e5c;
  270. }
  271. .title {
  272. font-size: $font-base + 2rpx;
  273. color: $font-color-dark;
  274. line-height: 1;
  275. width: 80%;
  276. }
  277. .attr-box {
  278. display: flex;
  279. justify-content: flex-end;
  280. font-size: $font-sm + 2rpx;
  281. color: $font-color-light;
  282. }
  283. .price {
  284. display: inline;
  285. font-size: $font-base + 2rpx;
  286. color: $font-color-dark;
  287. &:before {
  288. content: '¥';
  289. font-size: $font-sm;
  290. }
  291. }
  292. }
  293. }
  294. .good-top {
  295. height: 85rpx;
  296. font-size: 24rpx;
  297. font-weight: 400;
  298. color: #666666;
  299. line-height: 85rpx;
  300. display: flex;
  301. justify-content: space-between;
  302. .top-status {
  303. font-size: 28rpx;
  304. font-weight: 500;
  305. color: #EF041F;
  306. }
  307. }
  308. .goods-buttom {
  309. height: 160rpx;
  310. display: flex;
  311. .good-img {
  312. width: 160rpx;
  313. height: 160rpx;
  314. // overflow: hidden;
  315. image {
  316. width: 160rpx;
  317. height: 160rpx;
  318. }
  319. }
  320. .good-title {
  321. width: 350rpx;
  322. padding-top: 6rpx;
  323. font-size: 26rpx;
  324. font-weight: 500;
  325. color: #3F454B;
  326. line-height: 1;
  327. padding-left: 10rpx;
  328. }
  329. .shop-info {
  330. padding-top: 11rpx;
  331. font-size: 24rpx;
  332. font-weight: 500;
  333. color: #DCB876;
  334. line-height: 1;
  335. // padding-left: 10rpx;
  336. image {
  337. width: 24rpx;
  338. height: 24rpx;
  339. margin-left: 14rpx;
  340. margin-right: 4rpx;
  341. }
  342. }
  343. .good-tag {
  344. display: inline-block;
  345. height: 36rpx;
  346. background: #ffeee9;
  347. // opacity: 0.2;
  348. border-radius: 5rpx;
  349. font-size: 20rpx;
  350. font-weight: 500;
  351. color: #F23030;
  352. padding: 0 9rpx;
  353. line-height: 36rpx;
  354. margin-top: 15rpx;
  355. margin-left: 10rpx;
  356. }
  357. }
  358. .good-hj {
  359. line-height: 1;
  360. height: 26rpx;
  361. font-size: 26rpx;
  362. font-weight: 500;
  363. color: #333333;
  364. text-align: right;
  365. }
  366. .good-price {
  367. text-align: left;
  368. font-size: 26rpx;
  369. font-weight: 500;
  370. line-height: 1;
  371. color: #333333;
  372. position: absolute;
  373. right: 31rpx;
  374. top: 98rpx;
  375. }
  376. .good-num {
  377. text-align: left;
  378. font-size: 26rpx;
  379. font-weight: 500;
  380. line-height: 1;
  381. color: #333333;
  382. position: absolute;
  383. right: 31rpx;
  384. top: 136rpx;
  385. }
  386. }
  387. .hx-wrapper {
  388. width: 536rpx;
  389. height: 630rpx;
  390. position: relative;
  391. // background-color: #fff;
  392. .hx-img {
  393. width: 536rpx;
  394. height: 281rpx;
  395. image {
  396. width: 536rpx;
  397. height: 281rpx;
  398. }
  399. }
  400. .hx-close {
  401. position: absolute;
  402. left: 243rpx;
  403. bottom: -80rpx;
  404. width: 52rpx;
  405. height: 52rpx;
  406. image {
  407. width: 52rpx;
  408. height: 52rpx;
  409. }
  410. }
  411. .hx-body {
  412. width: 536rpx;
  413. height: 349rpx;
  414. background-color: #fff;
  415. border-radius: 0 0 10rpx 10rpx;
  416. .hx-title {
  417. width: 536rpx;
  418. font-size: 36rpx;
  419. font-weight: 500;
  420. color: #333333;
  421. line-height: 1;
  422. padding-top: 42rpx;
  423. text-align: center;
  424. }
  425. input {
  426. width: 439rpx;
  427. height: 68rpx;
  428. background: #eeddde;
  429. border-radius: 10rpx;
  430. margin: 39rpx auto 0;
  431. padding-left: 26rpx;
  432. .hx-placeholder {
  433. font-size: 26rpx;
  434. font-weight: 500;
  435. color: #901b21;
  436. }
  437. }
  438. .hx-btn {
  439. margin: 44rpx auto 0;
  440. width: 353rpx;
  441. height: 71rpx;
  442. background: #901b21;
  443. border-radius: 34rpx;
  444. font-size: 36rpx;
  445. font-weight: 500;
  446. color: #F8F9F9;
  447. line-height: 71rpx;
  448. text-align: center;
  449. }
  450. }
  451. }
  452. .navbar {
  453. display: flex;
  454. height: 40px;
  455. padding: 0 5px;
  456. background: #fff;
  457. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  458. position: relative;
  459. z-index: 10;
  460. .nav-item {
  461. flex: 1;
  462. display: flex;
  463. justify-content: center;
  464. align-items: center;
  465. height: 100%;
  466. font-size: 15px;
  467. color: $font-color-dark;
  468. position: relative;
  469. &.current {
  470. color: $base-color;
  471. &:after {
  472. content: '';
  473. position: absolute;
  474. left: 50%;
  475. bottom: 0;
  476. transform: translateX(-50%);
  477. width: 44px;
  478. height: 0;
  479. border-bottom: 2px solid $base-color;
  480. }
  481. }
  482. }
  483. }
  484. .fh-btn-wrap {
  485. display: flex;
  486. // height: 55rpx;
  487. flex-direction: column;
  488. // justify-content: flex-end;
  489. // width: ;
  490. font-size: 28rpx;
  491. color: #999999;
  492. .fh-btn-tit {
  493. color: #000000;
  494. font-weight: bold;
  495. }
  496. .fh-btn-info {
  497. padding-left: 20rpx;
  498. }
  499. .fh-btn {
  500. margin-top: 10rpx;
  501. align-self: flex-end;
  502. width: 144rpx;
  503. height: 55rpx;
  504. border: 1px solid #901b21;
  505. border-radius: 28rpx;
  506. font-size: 26rpx;
  507. font-family: PingFang SC;
  508. font-weight: 500;
  509. color: #901b21;
  510. line-height: 55rpx;
  511. text-align: center;
  512. }
  513. }
  514. </style>