index.vue 8.3 KB

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