coupon.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view class="digitShelf-pagesCons">
  3. <view class="tab-body">
  4. <view>
  5. <u-tabs-swiper ref="uTabs" :list="tabList" :offset="[5,40]" bar-width='100' active-color="#1283d4" name="dispName" :current="current" @change="tabsChange" :is-scroll="false"
  6. swiperWidth="750"></u-tabs-swiper>
  7. </view>
  8. <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
  9. <swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;" v-for="(tabs, indexs) in tabList" :key="indexs">
  10. <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
  11. <view
  12. class="check-order-list"
  13. v-for="(item,index) in 10"
  14. :key="item"
  15. >
  16. <view>
  17. <view class="dio dio-left"></view>
  18. <view class="dio dio-right"></view>
  19. <view class="check-order-left" :class="'imgbg-'+current">
  20. ¥<text>100</text>
  21. </view>
  22. <view class="check-order-right">
  23. <view class="check-order-title">满1000减100</view>
  24. <view class="check-order-subtitle">箭冠轮胎,五一大福利。</view>
  25. <view class="check-order-date">
  26. <view v-if="current!=1">2024.07.22 13:00:00 至</view>
  27. <view v-if="current!=1">2024.08.22 13:00:00 到期 </view>
  28. <view class="use-date" v-if="current==1">使用时间:2021-12-31</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view>
  33. <view class="check-order-desc" :class="'border-'+current" @click="item.showDesc = !item.showDesc">
  34. <text>使用说明:</text>
  35. <u-icon name="arrow-down"></u-icon>
  36. </view>
  37. <view class="check-order-desc-content">
  38. 仅限箭冠产品,轮胎类,满1000,才能使用。
  39. </view>
  40. </view>
  41. </view>
  42. <view style="padding: 20upx;">
  43. <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  44. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  45. </view>
  46. </scroll-view>
  47. </swiper-item>
  48. </swiper>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import carNo from '@/components/carNo.vue'
  54. import { getShelfTempBillList, shelfTempTotalWaitQty } from '@/api/shelf.js'
  55. import moment from 'moment'
  56. export default {
  57. components: {carNo},
  58. data() {
  59. return {
  60. theme:'',
  61. status: 'loading',
  62. noDataText: '暂无数据',
  63. tabList: [
  64. {
  65. dispName: '未使用',
  66. typeId: 1,
  67. count: 0
  68. },
  69. {
  70. dispName: '已使用',
  71. typeId: 2,
  72. count: 0
  73. },
  74. {
  75. dispName: '已过期',
  76. typeId: 3,
  77. count: 0
  78. },
  79. ],
  80. current: 0,
  81. swiperCurrent: 0,
  82. // 查询条件
  83. pageNo: 1,
  84. pageSize: 10,
  85. list: [],
  86. total: 0,
  87. }
  88. },
  89. onLoad() {
  90. let _this = this
  91. _this.pageInit()
  92. _this.theme = getApp().globalData.theme
  93. uni.$on('refreshOrder',function(data){
  94. _this.list = []
  95. _this.status = "loading"
  96. _this.pageInit()
  97. })
  98. },
  99. methods:{
  100. // 复制
  101. copyVin(vin){
  102. uni.setClipboardData({
  103. data: vin||'',
  104. })
  105. },
  106. message(title){
  107. uni.showToast({
  108. icon:'none',
  109. title: title
  110. })
  111. },
  112. pageInit(){
  113. this.total = 0
  114. this.pageNo = 1
  115. this.getRow()
  116. // 获取总条数
  117. this.getWaitTotal()
  118. },
  119. // tabs通知swiper切换
  120. tabsChange(index) {
  121. this.swiperCurrent = index;
  122. },
  123. swiperChange(event){
  124. console.log(event.detail)
  125. this.list = []
  126. this.status = "loading"
  127. },
  128. // swiper-item左右移动,通知tabs的滑块跟随移动
  129. transition(e) {
  130. let dx = e.detail.dx;
  131. this.$refs.uTabs.setDx(dx);
  132. },
  133. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  134. // swiper滑动结束,分别设置tabs和swiper的状态
  135. animationfinish(e) {
  136. let current = e.detail.current;
  137. if(current != this.current){
  138. this.$refs.uTabs.setFinishCurrent(current);
  139. this.swiperCurrent = current;
  140. this.current = current;
  141. this.pageInit()
  142. }
  143. },
  144. // scroll-view到底部加载更多
  145. onreachBottom() {
  146. console.log(this.list.length, this.total)
  147. if(this.list.length < this.total){
  148. this.pageNo += 1
  149. this.getRow()
  150. }else{
  151. this.status = "nomore"
  152. }
  153. },
  154. checkNums (states, i){
  155. if(states){
  156. let arr = states.split(',')
  157. return arr[i]
  158. }
  159. return 0
  160. },
  161. // 查询列表
  162. getRow (pageNo) {
  163. let _this = this
  164. if (pageNo) {
  165. this.pageNo = pageNo
  166. }
  167. let params = {
  168. pageNo: this.pageNo,
  169. pageSize: this.pageSize,
  170. }
  171. // 状态条件
  172. if(this.swiperCurrent == 1){
  173. params.billStateList = ['WAIT_AUDIT','AUDIT_REJECT','WAIT_OUT_WAREHOUSE']
  174. }
  175. if(this.swiperCurrent == 2){
  176. params.billStateList = ['FINISH']
  177. }
  178. this.status = "loading"
  179. getShelfTempBillList(params).then(res => {
  180. if (res.code == 200 || res.status == 204 || res.status == 200) {
  181. if(_this.pageNo>1){
  182. _this.list = _this.list.concat(res.data.list || [])
  183. }else{
  184. _this.list = res.data.list || []
  185. }
  186. _this.total = res.data.count || 0
  187. } else {
  188. _this.list = []
  189. _this.total = 0
  190. _this.noDataText = res.message
  191. }
  192. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  193. })
  194. },
  195. // 获取待拿货数量
  196. async getWaitTotal(){
  197. const ret = await shelfTempTotalWaitQty({billStateList:['WAIT_AUDIT','AUDIT_REJECT','WAIT_OUT_WAREHOUSE']}).then(res => res.data)
  198. this.tabList[1].count = ret || 0
  199. }
  200. }
  201. }
  202. </script>
  203. <style lang="scss">
  204. page{
  205. height: 100%;
  206. }
  207. .digitShelf-pagesCons{
  208. height: 100%;
  209. display: flex;
  210. flex-direction: column;
  211. .tab-body{
  212. .check-list{
  213. height: calc(100vh - 44px);
  214. }
  215. .check-order-list{
  216. background: #ffffff;
  217. margin: 25upx;
  218. border-radius: 30upx;
  219. box-shadow: 1px 1px 3px #EEEEEE;
  220. > view{
  221. &:first-child{
  222. position: relative;
  223. display: flex;
  224. align-items: center;
  225. justify-content: space-around;
  226. }
  227. }
  228. .dio{
  229. width: 30rpx;
  230. height: 30rpx;
  231. background: #f8f8f8;
  232. border-radius: 100rpx;
  233. position: absolute;
  234. z-index: 1000;
  235. }
  236. .dio-left{
  237. left: -15rpx;
  238. top: 85rpx;
  239. }
  240. .dio-right{
  241. right: -15rpx;
  242. top: 85rpx;
  243. }
  244. .check-order-left{
  245. width: 30%;
  246. height: 200rpx;
  247. display: flex;
  248. align-items: center;
  249. justify-content:center;
  250. font-size: 30rpx;
  251. text{
  252. font-size: 65rpx;
  253. }
  254. color: #fff;
  255. }
  256. .imgbg-0{
  257. background: #2196F3;
  258. }
  259. .imgbg-1{
  260. background: #f7e7b8;
  261. color: #FF9800;
  262. }
  263. .imgbg-2{
  264. background: #d2d1d1;
  265. }
  266. .check-order-right{
  267. width: 70%;
  268. padding: 0 25rpx;
  269. .check-order-title{
  270. font-size: 32rpx;
  271. }
  272. .check-order-subtitle{
  273. font-size: 28rpx;
  274. color: #666;
  275. margin: 10rpx 0;
  276. }
  277. .check-order-date{
  278. font-size: 24rpx;
  279. color: #666;
  280. .use-date{
  281. color: #ff5500;
  282. }
  283. }
  284. }
  285. .check-order-desc{
  286. font-size: 24rpx;
  287. color: #666;
  288. padding: 10rpx 20rpx;
  289. border-top: 1rpx solid #2196F3;
  290. display: flex;
  291. justify-content: space-between;
  292. }
  293. .border-0{
  294. border-top: 1rpx solid #eee;
  295. }
  296. .border-1{
  297. border-top: 1rpx solid #f7e7b8;
  298. }
  299. .border-2{
  300. border-top: 1rpx solid #d2d1d1;
  301. }
  302. .check-order-desc-content{
  303. padding: 5rpx 25rpx 25rpx 25rpx;
  304. font-size: 24rpx;
  305. }
  306. }
  307. }
  308. }
  309. </style>