index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <template>
  2. <!-- 奖励明细页面 -->
  3. <view class="header">
  4. <view class="header-one">
  5. </view>
  6. <view class="content">
  7. <view style="width: 100%;">
  8. <!-- <u-tabs style="width: 350rpx;float: left;margin-top: 0;" :list="list" :is-scroll="false" :current="current" @change="change"
  9. active-color="#fff" inactive-color="#ffffff" bg-color="#ffffff00"></u-tabs> -->
  10. <view style="width: 340rpx;height: 80rpx;text-align: center;padding-top: 25rpx;padding-left: 20rpx;float: left;margin-top: 0;margin-left: 30rpx;">
  11. <view style="float: left;">
  12. <text @click="whole">全部</text>
  13. <view v-if="bottoma == true" style="width: 100%;height: 1rpx;background-color: #FFFFFF;border-radius: 10rpx;"></view>
  14. <view v-else></view>
  15. </view>
  16. <view style="float: left;margin-left: 70rpx;">
  17. <text @click="brand">品牌</text>
  18. <view v-if="bottomb == true" style="width: 100%;height: 1rpx;background-color: #FFFFFF;border-radius: 10rpx;"></view>
  19. <view v-else></view>
  20. </view>
  21. <view style="float: left;margin-left: 70rpx;">
  22. <text @click="time_s">时间</text>
  23. <view v-if="bottomc == true" style="width: 100%;height: 1rpx;background-color: #FFFFFF;border-radius: 10rpx;"></view>
  24. <view v-else></view>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- <u-tabs style="width: 500rpx;" bg-color="#0095ff" inactive-color="#FFFFFF" active-color="#fff" :list="list"
  29. :is-scroll="false" :current="current" @change="change"></u-tabs> -->
  30. <u-select :mask-close-able="false" @cancel="clear" style=" color: #fff;" @confirm="confirm" v-model="showBrand"
  31. value-name="brandId" label-name="brandName" :list="brandList"></u-select>
  32. <u-calendar style=" color: #fff;" @click="calendar" @change="changetime" v-model="showDate" :mode="mode"></u-calendar>
  33. <view>
  34. <u-search style="width: 320rpx;" placeholder="请输入胎号或规格" v-model="input" :clearabled="true" @change="handleSearch"
  35. :show-action="false" :animation="true"></u-search>
  36. </view>
  37. </view>
  38. <view v-if="count!=0">
  39. <view class="content-one" v-for="(item,index) in datalist" :key="index">
  40. <view class="content-one-view">
  41. </view>
  42. <view class="content-one-text">获得奖励:{{item.money}}元</view>
  43. <view class="content-two">
  44. <view class="">
  45. 轮胎型号
  46. </view>
  47. <view class="">
  48. {{item.tireModel}}
  49. </view>
  50. </view>
  51. <view class="content-two">
  52. <view class="">
  53. 扫码胎号
  54. </view>
  55. <view class="">
  56. {{item.tyreNum}}
  57. </view>
  58. </view>
  59. <view class="content-two">
  60. <view class="">
  61. 奖励类型
  62. </view>
  63. <view class="">
  64. {{getWay}}
  65. </view>
  66. </view>
  67. <view class="content-two">
  68. <view class="">
  69. 获得时间
  70. </view>
  71. <view class="">
  72. {{item.createTime}}
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <view v-else style="margin-top: 400rpx;">
  78. <u-empty text="暂无数据" mode="list"></u-empty>
  79. </view>
  80. <u-loadmore v-if="datalist.length>3" :status="status" />
  81. </view>
  82. </template>
  83. <script>
  84. import {
  85. request
  86. } from '../../../common/request/request'
  87. require("promise.prototype.finally").shim()
  88. export default {
  89. data() {
  90. return {
  91. datalist: [],
  92. status: 'loadmore',
  93. getWay: '',
  94. input: '',
  95. bottoma: true,
  96. bottomb: false,
  97. bottomc: false,
  98. list: [{
  99. name: '全部'
  100. }, {
  101. name: '品牌'
  102. }, {
  103. name: '时间',
  104. }],
  105. brandList: JSON.parse(JSON.stringify([])),
  106. current: 0,
  107. // 默认页数
  108. current1: 1,
  109. showBrand: false,
  110. showDate: false,
  111. mode: 'range',
  112. // 开始时间
  113. startTime: '',
  114. // 结束时间
  115. endTime: '',
  116. pages: '',
  117. count: '',
  118. datalength: '',
  119. label: '',
  120. };
  121. },
  122. created() {
  123. this.whole()
  124. this.getBrandList()
  125. },
  126. methods: {
  127. // 获取奖励明细
  128. data() {
  129. uni.showLoading({
  130. title: '加载中...'
  131. });
  132. request({
  133. url: '/myPage/getPageScanRewordList',
  134. method: 'post',
  135. data: {
  136. storeId: this.$store.state.storeInfo.storeId,
  137. userId: this.$store.state.storeInfo.userId,
  138. 'searchKey': this.input,
  139. 'current': this.current1,
  140. 'size': '10'
  141. }
  142. }).then(res => {
  143. console.log(res)
  144. // this.datalist = res.data.data
  145. this.count = res.data.count
  146. // this.datalength = res.data.data.length
  147. this.datalist = this.datalist.concat(res.data.data)
  148. // 判断扫码类型
  149. for (var i = 0; i < res.data.data.length; i++) {
  150. if (res.data.data[i].getWay == 0) {
  151. this.getWay = "门店扫码"
  152. } else {
  153. this.getWay = "车主扫码"
  154. }
  155. }
  156. }).catch(err => {
  157. console.log(err)
  158. })
  159. .finally(() => {
  160. setTimeout(() => {
  161. uni.hideLoading();
  162. this.loading = false;
  163. }, 1000)
  164. })
  165. },
  166. calendar() {
  167. console.log("@@@")
  168. },
  169. // 全部事件
  170. whole() {
  171. console.log("@@")
  172. this.bottoma = true
  173. this.bottomb = false
  174. this.bottomc = false
  175. this.current1 = 1
  176. this.data()
  177. this.datalist = []
  178. },
  179. // 品牌事件
  180. brand() {
  181. this.showBrand = true
  182. this.bottomb = true
  183. this.bottoma = false
  184. this.bottomc = false
  185. this.current1 = 1
  186. this.datalist = []
  187. },
  188. // 时间事件
  189. time_s() {
  190. this.showDate = true
  191. this.bottoma = false
  192. this.bottomc = true
  193. this.bottomb = false
  194. this.current1 = 1
  195. this.datalist = []
  196. },
  197. // 时间选择器获取时间
  198. changetime(e) {
  199. console.log(e)
  200. this.startTime = e.startDate
  201. this.endTime = e.endDate
  202. this.datalist = []
  203. uni.showLoading({
  204. title: '加载中...'
  205. });
  206. request({
  207. url: '/myPage/getPageScanRewordList',
  208. method: 'post',
  209. data: {
  210. storeId: this.$store.state.storeInfo.storeId,
  211. userId: this.$store.state.storeInfo.userId,
  212. 'current': this.current1,
  213. 'size': '10',
  214. 'startTime': this.startTime + ' 00:00:00',
  215. 'endTime': this.endTime + ' 23:59:59'
  216. }
  217. }).then(res => {
  218. console.log(res)
  219. this.datalist = this.datalist.concat(res.data.data)
  220. this.count = res.data.count
  221. // 判断扫码类型
  222. for (var i = 0; i < res.data.data.length; i++) {
  223. if (res.data.data[i].getWay == 0) {
  224. this.getWay = "车主扫码"
  225. } else {
  226. this.getWay = "门店扫码"
  227. }
  228. }
  229. console.log(res.data.data)
  230. }).catch(err => {
  231. console.log(err)
  232. })
  233. .finally(() => {
  234. setTimeout(() => {
  235. uni.hideLoading();
  236. this.loading = false;
  237. }, 1000)
  238. })
  239. },
  240. // 获取品牌列表
  241. getBrandList() {
  242. request({
  243. url: '/baseReq/getBrandList',
  244. method: 'post',
  245. data: {
  246. storeId: this.$store.state.storeInfo.storeId,
  247. userId: this.$store.state.storeInfo.userId
  248. }
  249. }).then(res => {
  250. this.brandList = JSON.parse(JSON.stringify(res.data.data))
  251. }).catch(err => {
  252. console.log(err)
  253. })
  254. .finally(() => {
  255. setTimeout(() => {
  256. uni.hideLoading();
  257. this.loading = false;
  258. }, 1000)
  259. })
  260. },
  261. // 搜索框
  262. handleSearch(e) {
  263. console.log(e)
  264. this.data()
  265. this.datalist = []
  266. },
  267. // 点击获取品牌
  268. confirm(e) {
  269. console.log(e)
  270. console.log(e[0].label)
  271. this.label = e[0].label
  272. uni.showLoading({
  273. title: '加载中...'
  274. });
  275. request({
  276. url: '/myPage/getPageScanRewordList',
  277. method: 'post',
  278. data: {
  279. storeId: this.$store.state.storeInfo.storeId,
  280. userId: this.$store.state.storeInfo.userId,
  281. 'current': this.current1,
  282. 'size': '10',
  283. 'brandCode': this.label
  284. }
  285. }).then(res => {
  286. console.log(res)
  287. this.count = res.data.count
  288. this.datalength = res.data.data.length
  289. this.datalist = this.datalist.concat(res.data.data)
  290. // 判断扫码类型
  291. for (var i = 0; i < res.data.data.length; i++) {
  292. if (res.data.data[i].getWay == 0) {
  293. this.getWay = "车主扫码"
  294. } else {
  295. this.getWay = "门店扫码"
  296. }
  297. }
  298. console.log(res.data.data)
  299. }).catch(err => {
  300. console.log(err)
  301. })
  302. .finally(() => {
  303. setTimeout(() => {
  304. uni.hideLoading();
  305. this.loading = false;
  306. }, 1000)
  307. })
  308. },
  309. // 点击取消按钮
  310. clear() {
  311. this.current = 0
  312. console.log("@@")
  313. },
  314. change(index) {
  315. this.current = index;
  316. if (this.current == 1) {
  317. this.showBrand = true
  318. this.datalist = []
  319. } else if (this.current == 2) {
  320. this.showDate = true
  321. this.datalist = []
  322. }
  323. this.current1 = 1
  324. this.datalist = []
  325. this.data()
  326. }
  327. },
  328. onReachBottom() {
  329. console.log("@@@")
  330. console.log(this.count)
  331. console.log(this.datalength)
  332. console.log(this.current1)
  333. this.status = 'loading';
  334. setTimeout(() => {
  335. if (this.datalist.length >= this.count) {
  336. this.status = 'nomore';
  337. } else {
  338. this.current1 = ++this.current1;
  339. this.data()
  340. }
  341. }, 1000)
  342. }
  343. }
  344. </script>
  345. <style lang="scss" scoped>
  346. .header {
  347. height: 400rpx;
  348. width: 100%;
  349. background: #0094FE;
  350. color: #fff;
  351. font-size: 28rpx;
  352. }
  353. .header-one {
  354. text-align: center;
  355. padding-top: 10rpx;
  356. }
  357. .header-one>text {
  358. font-size: 52rpx;
  359. }
  360. .content {
  361. display: flex;
  362. justify-content: space-between;
  363. width: 700rpx;
  364. margin-top: 80rpx;
  365. }
  366. .content-one {
  367. width: 690rpx;
  368. height: 315rpx;
  369. background: #FFFFFF;
  370. box-shadow: 0px 0px 24px 0px rgba(101, 176, 249, 0.41);
  371. border-radius: 20rpx;
  372. margin: 0 auto;
  373. margin-top: 30rpx;
  374. }
  375. .content-one-view {
  376. width: 6rpx;
  377. height: 30rpx;
  378. background: #0292FD;
  379. position: relative;
  380. top: 20rpx;
  381. left: 30rpx;
  382. }
  383. .content-one-text {
  384. position: relative;
  385. top: -8rpx;
  386. left: 60rpx;
  387. font-size: 24rpx;
  388. font-weight: bold;
  389. color: #000;
  390. }
  391. .content-one-time {
  392. position: relative;
  393. top: -40rpx;
  394. left: 530rpx;
  395. font-size: 13rpx;
  396. color: #626262;
  397. }
  398. .content-two {
  399. display: flex;
  400. justify-content: space-between;
  401. font-size: 24rpx;
  402. color: #6A6A6A;
  403. margin-top: 25rpx;
  404. margin-left: 30rpx;
  405. margin-right: 30rpx;
  406. }
  407. </style>