index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <view>
  3. <view v-if="orderList.length > 0">
  4. <view class='cancellate'>
  5. <view>
  6. <view class="order acea-row row-between">
  7. <view class="order_sn">订单号:{{orderData.order_sn}}</view>
  8. <view class="btn" @click="goBack">上一步</view>
  9. </view>
  10. <view class='list'>
  11. <view class="acea-row row-between header">
  12. <view class="info">
  13. <view class="name">{{orderData.total_num}}件</view>
  14. </view>
  15. <!-- <navigator url="" hover-class='none' class="coupon-btn">查看 <text class="iconfont icon-xiangyou"></text></navigator> -->
  16. </view>
  17. <view class='item acea-row row-between-wrapper'>
  18. <view v-for="goods in orderList" :key="goods.cart_id" class='picTxt acea-row'>
  19. <view v-if="goods.refund_num > 0 && orderData.status == 0" class="checkbox" @click.stop="goodsCheck(goods)">
  20. <text v-if="goods.check" class="iconfont icon-xuanzhong1"></text>
  21. <text v-else class="iconfont icon-weixuanzhong"></text>
  22. </view>
  23. <view v-else class="checkbox">
  24. <text class="iconfont icon-weixuanzhong disabled"></text>
  25. </view>
  26. <view class='pictrue'>
  27. <image :src='goods.cart_info.product.image'></image>
  28. </view>
  29. <view class='text'>
  30. <view class='line1 name'>{{goods.cart_info.product.store_name}}</view>
  31. <view class='money acea-row row-middle'>
  32. <text>{{goods.cart_info.productAttr.price}}</text>
  33. </view>
  34. <view class="callate_bom acea-row row-between">
  35. <view class="callate_text refund_text">x{{goods.product_num}}</view>
  36. <view class='carnum acea-row row-center-wrapper'>
  37. <view class="reduce" :class="(goods.numSub || goods.refund_num == 1) ? 'on' : ''" @click.stop='subCart(goods)'>-</view>
  38. <view class='num'>{{goods.refund_num}}</view>
  39. <view class="plus" :class="(goods.max_count == goods.refund_num || goods.numAdd) ? 'on' : ''" @click.stop='addCart(goods)'>+</view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class='footer acea-row row-between-wrapper' v-if="orderList.length > 0">
  49. <view>
  50. <view class="allcheckbox" @click.stop="checkboxAllChange">
  51. <text v-if="!isAllSelect" class="iconfont icon-weixuanzhong"></text>
  52. <text v-else class="iconfont icon-xuanzhong1"></text>
  53. 全选
  54. </view>
  55. </view>
  56. <view class='money acea-row row-middle'>
  57. <form @submit="goCallate" report-submit='true'>
  58. <button class='placeOrder' formType="submit">立即核销</button>
  59. </form>
  60. </view>
  61. </view>
  62. </view>
  63. <view v-else>
  64. <emptyPage title="暂无订单信息~"></emptyPage>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. // +----------------------------------------------------------------------
  70. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  71. // +----------------------------------------------------------------------
  72. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  73. // +----------------------------------------------------------------------
  74. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  75. // +----------------------------------------------------------------------
  76. // | Author: CRMEB Team <admin@crmeb.com>
  77. // +----------------------------------------------------------------------
  78. import {
  79. verifierOrder, orderVerific
  80. } from '@/api/admin.js';
  81. import { getProductHot } from '@/api/store.js';
  82. import { mapGetters } from "vuex";
  83. import { toLogin } from '@/libs/login.js';
  84. import emptyPage from '@/components/emptyPage.vue'
  85. import { configMap } from '@/utils';
  86. const app = getApp();
  87. export default {
  88. components: {
  89. emptyPage
  90. },
  91. data() {
  92. return {
  93. loading: false, //是否加载中
  94. loadend: false, //是否加载完毕
  95. loadTitle: '加载更多', //提示语
  96. cartCount: 0,
  97. hostProduct: [],
  98. orderData: {},
  99. orderList: [],
  100. verify_code: '',
  101. mer_id: '',
  102. isAllSelect: true, //全选
  103. selectValue: [], //选中的数据
  104. selectCountPrice: 0.00,
  105. isScan: 0,
  106. };
  107. },
  108. computed: mapGetters(['isLogin']),
  109. onReady(){},
  110. mounted: function() {},
  111. onLoad: function(options) {
  112. let that = this;
  113. that.verify_code = options.cal_code
  114. that.mer_id = options.mer_id
  115. that.isScan = options.is_jump
  116. },
  117. onShow: function() {
  118. if (this.isLogin == true) {
  119. this.getOrderData();
  120. }else{
  121. setTimeout(() =>{
  122. toLogin()
  123. }, 300);
  124. }
  125. },
  126. methods: {
  127. goBack: function() {
  128. if(this.isScan==1){
  129. uni.navigateTo({
  130. url: '/pages/admin/order_cancellation/index?mer_id='+this.mer_id
  131. });
  132. }else{
  133. uni.navigateBack();
  134. }
  135. },
  136. getOrderData(){
  137. let that = this
  138. verifierOrder(that.mer_id,that.verify_code)
  139. .then(res => {
  140. that.orderData = res.data
  141. that.orderList = res.data.orderProduct
  142. that.orderList.forEach((item) => {
  143. item.max_count = item.refund_num
  144. this.$set(item, "check", true);
  145. })
  146. }).catch(res => {
  147. that.$util.Tips({
  148. title: res
  149. });
  150. setTimeout(()=>{
  151. uni.switchTab({
  152. url: '/pages/user/index'
  153. });
  154. },500)
  155. })
  156. },
  157. // 商品递减
  158. subCart(goods) {
  159. if(goods.refund_num <= 0){
  160. return
  161. }else{
  162. if (goods.refund_num <= 1) {
  163. goods.refund_num = 1;
  164. goods.numSub = true;
  165. } else {
  166. goods.refund_num--
  167. goods.numAdd = false;
  168. }
  169. }
  170. },
  171. // 商品增加
  172. addCart(goods) {
  173. if(goods.max_count <= goods.refund_num){
  174. goods.refund_num = goods.max_count
  175. goods.numAdd = true;
  176. }else{
  177. goods.refund_num++
  178. goods.numSub = false;
  179. }
  180. },
  181. goCallate() {
  182. let that = this;
  183. let products = that.getSelectedProduct();
  184. if(products.length == 0){
  185. that.$util.Tips({
  186. title: '请勾选商品'
  187. });
  188. // uni.navigateTo({
  189. // url: '/pages/admin/order_cancellation/index?mer_id='+that.mer_id
  190. // });
  191. }else{
  192. orderVerific(that.mer_id,that.orderData.order_id,{verify_code: that.verify_code,data: products})
  193. .then(res => {
  194. that.$util.Tips({
  195. title: res.message
  196. });
  197. that.getOrderData();
  198. })
  199. .catch(res => {
  200. that.$util.Tips({
  201. title: res
  202. });
  203. setTimeout(()=>{
  204. uni.navigateTo({
  205. url: '/pages/admin/order_cancellation/index?mer_id='+that.mer_id
  206. });
  207. },500)
  208. });
  209. }
  210. },
  211. // 获取选中的商品
  212. getSelectedProduct(){
  213. let arr = []
  214. this.orderList.forEach((item) => {
  215. if(item.check && item.refund_num !=0){
  216. arr.push({id: item.order_product_id, num: item.refund_num})
  217. }
  218. })
  219. return arr
  220. },
  221. // 商品选中
  222. goodsCheck(goods) {
  223. goods.check = !goods.check
  224. this.cartAllCheck('goodsCheck')
  225. },
  226. // 全选
  227. checkboxAllChange() {
  228. this.isAllSelect = !this.isAllSelect
  229. this.cartAllCheck('allCheck')
  230. },
  231. // 全选判断
  232. cartAllCheck(type) {
  233. let tempArr = [], calArr = [];
  234. this.orderList.forEach((item) => {
  235. if((this.orderData.status == 0 && item.refund_num > 0)){
  236. calArr.push(item)
  237. }
  238. })
  239. if (type == 'goodsCheck') {
  240. tempArr = calArr.filter(item => {
  241. return item.check
  242. })
  243. this.isAllSelect = calArr.length == tempArr.length
  244. } else {
  245. calArr.forEach((item) => {
  246. item.check = this.isAllSelect
  247. if(item.check)tempArr.push(item)
  248. })
  249. }
  250. // 全选
  251. this.isAllSelect = tempArr.length == calArr.length ? true : false
  252. },
  253. },
  254. onReachBottom() {
  255. },
  256. // 滚动监听
  257. onPageScroll(e) {
  258. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  259. uni.$emit('scroll');
  260. }
  261. }
  262. </script>
  263. <style scoped lang="scss">
  264. page {
  265. background: #F5F5F5;
  266. }
  267. .cancellate {
  268. margin-top: 20rpx;
  269. padding: 0 30rpx;
  270. .order {
  271. background: #fff;
  272. height: 90rpx;
  273. border-radius: 16rpx;
  274. padding: 0 30rpx;
  275. align-items: center;
  276. color: #282828;
  277. font-size: 28rpx;
  278. .btn{
  279. width: 124rpx;
  280. height: 48rpx;
  281. display: flex;
  282. align-items: center;
  283. justify-content: center;
  284. border: 1px solid #707070;
  285. border-radius: 25rpx;
  286. }
  287. }
  288. .list{
  289. background: #fff;
  290. border-radius: 16rpx;
  291. margin-top: 20rpx;
  292. .header{
  293. height: 88rpx;
  294. line-height: 88rpx;
  295. padding: 0 30rpx;
  296. border-bottom: 1px solid #f0f0f0;
  297. .info{
  298. color: #282828;
  299. text{
  300. color: #999;
  301. }
  302. }
  303. .coupon-btn{
  304. color: #666;
  305. font-size: 24rpx;
  306. .iconfont{
  307. font-size: 20rpx;
  308. }
  309. }
  310. }
  311. }
  312. .item{
  313. padding: 20rpx;
  314. }
  315. .picTxt {
  316. width: 100%;
  317. position: relative;
  318. align-items: center;
  319. margin-bottom: 30rpx;
  320. .checkbox {
  321. width: 60rpx;
  322. .iconfont {
  323. font-size: 40rpx;
  324. color: #CCCCCC;
  325. border-radius: 100%;
  326. &.disabled{
  327. background: #f3f3f3;
  328. }
  329. }
  330. .icon-xuanzhong1 {
  331. color: #2291F8;
  332. }
  333. }
  334. .pictrue {
  335. width: 160rpx;
  336. height: 160rpx;
  337. image {
  338. width: 100%;
  339. height: 100%;
  340. border-radius: 6rpx;
  341. }
  342. }
  343. .text {
  344. width: 410rpx;
  345. margin-left: 20rpx;
  346. font-size: 28rpx;
  347. color: #282828;
  348. }
  349. .text .money {
  350. font-size: 26rpx;
  351. color: #282828;
  352. margin-top: 8rpx;
  353. }
  354. .callate_bom{
  355. margin-top: 20rpx;
  356. align-items: center;
  357. .callate_text{
  358. font-size: 26rpx;
  359. color: #999;
  360. &.refund_text{
  361. color: #FF9600;
  362. }
  363. &.uncall_text{
  364. color: #2291F8;
  365. }
  366. }
  367. }
  368. .carnum {
  369. height: 47rpx;
  370. }
  371. .carnum view {
  372. border: 1px solid #a4a4a4;
  373. min-width: 66rpx;
  374. text-align: center;
  375. height: 100%;
  376. line-height: 46rpx;
  377. font-size: 28rpx;
  378. color: #a4a4a4;
  379. }
  380. .reduce {
  381. border-right: 0;
  382. border-radius: 3rpx 0 0 3rpx;
  383. &.on{
  384. border-color: #e3e3e3;
  385. color: #dedede;
  386. }
  387. }
  388. .plus {
  389. border-left: 0;
  390. border-radius: 0 3rpx 3rpx 0;
  391. &.on{
  392. border-color: #e3e3e3;
  393. color: #dedede;
  394. }
  395. }
  396. .carnum .num {
  397. color: #282828;
  398. }
  399. }
  400. }
  401. .footer {
  402. z-index: 9;
  403. width: 100%;
  404. height: 96rpx;
  405. background-color: #fafafa;
  406. position: fixed;
  407. padding: 0 30rpx;
  408. box-sizing: border-box;
  409. border-top: 1px solid #eee;
  410. bottom: 0;
  411. }
  412. .footer .checkAll {
  413. font-size: 28rpx;
  414. color: #282828;
  415. margin-left: 16rpx;
  416. }
  417. .footer .placeOrder {
  418. color: #fff;
  419. font-size: 30rpx;
  420. width: 226rpx;
  421. height: 70rpx;
  422. border-radius: 50rpx;
  423. text-align: center;
  424. line-height: 70rpx;
  425. margin-left: 22rpx;
  426. background-color: #2291F8;
  427. }
  428. .allcheckbox {
  429. display: flex;
  430. align-items: center;
  431. width: 260rpx;
  432. .iconfont {
  433. margin-right: 20rpx;
  434. font-size: 40rpx;
  435. color: #CCCCCC;
  436. }
  437. .icon-xuanzhong1 {
  438. color: #2291F8;
  439. }
  440. }
  441. .footer .button .bnt {
  442. font-size: 28rpx;
  443. color: #999;
  444. border-radius: 50rpx;
  445. border: 1px solid #999;
  446. width: 160rpx;
  447. height: 60rpx;
  448. text-align: center;
  449. line-height: 60rpx;
  450. &.bt-color {
  451. color: #2291F8;
  452. border: 1px solid #2291F8;
  453. }
  454. }
  455. </style>