index.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  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 :mask-close-able="false" :list="list_a" @click="click" @close="close" v-model="showBrand"></u-action-sheet>
  33. <u-calendar :mask-close-able="false" 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. this.count = res.data.count
  146. this.datalist = this.datalist.concat(res.data.data)
  147. // 判断扫码类型
  148. for (var i = 0; i < res.data.data.length; i++) {
  149. if (res.data.data[i].getWay == 0) {
  150. this.getWay = "门店扫码"
  151. } else {
  152. this.getWay = "车主扫码"
  153. }
  154. }
  155. }).catch(err => {
  156. console.log(err)
  157. })
  158. .finally(() => {
  159. setTimeout(() => {
  160. uni.hideLoading();
  161. this.loading = false;
  162. }, 1000)
  163. })
  164. },
  165. calendar() {
  166. },
  167. // 全部事件
  168. whole() {
  169. this.bottoma = true
  170. this.bottomb = false
  171. this.bottomc = false
  172. this.current1 = 1
  173. this.data()
  174. this.datalist = []
  175. },
  176. // 品牌事件
  177. brand() {
  178. this.showBrand = true
  179. this.bottomb = true
  180. this.bottoma = false
  181. this.bottomc = false
  182. this.current1 = 1
  183. this.datalist = []
  184. },
  185. // 时间事件
  186. time_s() {
  187. this.showDate = true
  188. this.bottoma = false
  189. this.bottomc = true
  190. this.bottomb = false
  191. this.current1 = 1
  192. this.datalist = []
  193. },
  194. // 时间选择器获取时间
  195. changetime(e) {
  196. console.log(e)
  197. this.startTime = e.startDate
  198. this.endTime = e.endDate
  199. this.datalist = []
  200. uni.showLoading({
  201. title: '加载中...'
  202. });
  203. request({
  204. url: '/myPage/getPageScanRewordList',
  205. method: 'post',
  206. data: {
  207. storeId: this.$store.state.storeInfo.storeId,
  208. userId: this.$store.state.storeInfo.userId,
  209. 'current': this.current1,
  210. 'size': '10',
  211. 'startTime': this.startTime + ' 00:00:00',
  212. 'endTime': this.endTime + ' 23:59:59'
  213. }
  214. }).then(res => {
  215. this.datalist = this.datalist.concat(res.data.data)
  216. this.count = res.data.count
  217. // 判断扫码类型
  218. for (var i = 0; i < res.data.data.length; i++) {
  219. if (res.data.data[i].getWay == 0) {
  220. this.getWay = "车主扫码"
  221. } else {
  222. this.getWay = "门店扫码"
  223. }
  224. }
  225. }).catch(err => {
  226. console.log(err)
  227. })
  228. .finally(() => {
  229. setTimeout(() => {
  230. uni.hideLoading();
  231. this.loading = false;
  232. }, 1000)
  233. })
  234. },
  235. // 获取品牌列表
  236. getBrandList() {
  237. request({
  238. url: '/baseReq/getBrandListByStoreId',
  239. method: 'post',
  240. data: {
  241. storeId: this.$store.state.storeInfo.storeId,
  242. userId: this.$store.state.storeInfo.userId
  243. }
  244. }).then(res => {
  245. this.brandList = JSON.parse(JSON.stringify(res.data.data))
  246. for (var i = 0; i < this.brandList.length; i++) {
  247. this.list_a.push({
  248. brandCode: this.brandList[i].brandCode,
  249. text: this.brandList[i].brandName,
  250. color: '#000',
  251. fontSize: 28
  252. })
  253. }
  254. }).catch(err => {
  255. console.log(err)
  256. })
  257. .finally(() => {
  258. setTimeout(() => {
  259. uni.hideLoading();
  260. this.loading = false;
  261. }, 1000)
  262. })
  263. },
  264. // 搜索框
  265. handleSearch(e) {
  266. this.data()
  267. this.datalist = []
  268. },
  269. // 点击获取品牌
  270. click(e) {
  271. this.label = this.list_a[e].text
  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. this.count = res.data.count
  287. this.datalength = res.data.data.length
  288. this.datalist = this.datalist.concat(res.data.data)
  289. // 判断扫码类型
  290. for (var i = 0; i < res.data.data.length; i++) {
  291. if (res.data.data[i].getWay == 0) {
  292. this.getWay = "车主扫码"
  293. } else {
  294. this.getWay = "门店扫码"
  295. }
  296. }
  297. }).catch(err => {
  298. console.log(err)
  299. })
  300. .finally(() => {
  301. setTimeout(() => {
  302. uni.hideLoading();
  303. this.loading = false;
  304. }, 1000)
  305. })
  306. },
  307. // 点击取消按钮
  308. close() {
  309. this.whole()
  310. },
  311. change(index) {
  312. this.current = index;
  313. if (this.current == 1) {
  314. this.showBrand = true
  315. this.datalist = []
  316. } else if (this.current == 2) {
  317. this.showDate = true
  318. this.datalist = []
  319. }
  320. this.current1 = 1
  321. this.datalist = []
  322. this.data()
  323. }
  324. },
  325. onReachBottom() {
  326. this.status = 'loading';
  327. setTimeout(() => {
  328. if (this.datalist.length >= this.count) {
  329. this.status = 'nomore';
  330. } else {
  331. this.current1 = ++this.current1;
  332. this.data()
  333. }
  334. }, 1000)
  335. }
  336. }
  337. </script>
  338. <style lang="scss" scoped>
  339. .header {
  340. height: 400rpx;
  341. width: 100%;
  342. background: #0094FE;
  343. color: #fff;
  344. font-size: 28rpx;
  345. }
  346. .header-one {
  347. text-align: center;
  348. padding-top: 10rpx;
  349. }
  350. .header-one>text {
  351. font-size: 52rpx;
  352. }
  353. .content {
  354. display: flex;
  355. justify-content: space-between;
  356. width: 700rpx;
  357. margin-top: 80rpx;
  358. }
  359. .content-one {
  360. width: 690rpx;
  361. height: 315rpx;
  362. background: #FFFFFF;
  363. box-shadow: 0px 0px 24px 0px rgba(101, 176, 249, 0.41);
  364. border-radius: 20rpx;
  365. margin: 0 auto;
  366. margin-top: 30rpx;
  367. }
  368. .content-one-view {
  369. width: 6rpx;
  370. height: 30rpx;
  371. background: #0292FD;
  372. position: relative;
  373. top: 20rpx;
  374. left: 30rpx;
  375. }
  376. .content-one-text {
  377. // position: relative;
  378. // top: -8rpx;
  379. // left: 60rpx;
  380. margin-left: 50rpx;
  381. margin-top: -14rpx;
  382. font-size: 30rpx;
  383. font-weight: bold;
  384. color: #000;
  385. }
  386. .content-one-time {
  387. position: relative;
  388. top: -40rpx;
  389. left: 530rpx;
  390. font-size: 13rpx;
  391. color: #626262;
  392. }
  393. .content-two {
  394. display: flex;
  395. justify-content: space-between;
  396. font-size: 26rpx;
  397. color: #6A6A6A;
  398. margin-top: 25rpx;
  399. margin-left: 30rpx;
  400. margin-right: 30rpx;
  401. }
  402. </style>