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