index.vue 10 KB

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