index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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" @change="handleSearch" :show-action="false" :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 = this.datalist.concat(res.data.data)
  157. this.count = res.data.count
  158. // 判断扫码类型
  159. for (var i = 0; i < res.data.data.length; i++) {
  160. if (res.data.data[i].getWay == 0) {
  161. this.getWay = "车主扫码"
  162. } else {
  163. this.getWay = "门店扫码"
  164. }
  165. }
  166. console.log(res.data.data)
  167. }).catch(err => {
  168. console.log(err)
  169. })
  170. .finally(() => {
  171. setTimeout(() => {
  172. uni.hideLoading();
  173. this.loading = false;
  174. }, 1000)
  175. })
  176. },
  177. // 获取品牌列表
  178. getBrandList() {
  179. request({
  180. url: '/baseReq/getBrandList',
  181. method: 'post',
  182. data: {
  183. storeId:this.$store.state.storeInfo.storeId,
  184. userId:this.$store.state.storeInfo.userId
  185. }
  186. }).then(res => {
  187. this.brandList = JSON.parse(JSON.stringify(res.data.data))
  188. }).catch(err => {
  189. console.log(err)
  190. })
  191. .finally(() => {
  192. setTimeout(() => {
  193. uni.hideLoading();
  194. this.loading = false;
  195. }, 1000)
  196. })
  197. },
  198. // 搜索框
  199. handleSearch(e) {
  200. console.log(e)
  201. this.current = 0
  202. this.datalist = []
  203. this.data()
  204. },
  205. // 点击获取品牌
  206. confirm(e) {
  207. console.log(e)
  208. console.log(e[0].label)
  209. this.label = e[0].label
  210. request({
  211. url: '/myPage/getPageScanRewordList',
  212. method: 'post',
  213. data: {
  214. storeId:this.$store.state.storeInfo.storeId,
  215. userId:this.$store.state.storeInfo.userId,
  216. 'current': '1',
  217. 'size': '10',
  218. 'searchKey': this.label
  219. }
  220. }).then(res => {
  221. console.log(res)
  222. this.count = res.data.count
  223. this.datalength = res.data.data.length
  224. this.datalist = this.datalist.concat(res.data.data)
  225. // 判断扫码类型
  226. for (var i = 0; i < res.data.data.length; i++) {
  227. if (res.data.data[i].getWay == 0) {
  228. this.getWay = "车主扫码"
  229. } else {
  230. this.getWay = "门店扫码"
  231. }
  232. }
  233. console.log(res.data.data)
  234. }).catch(err => {
  235. console.log(err)
  236. })
  237. .finally(() => {
  238. setTimeout(() => {
  239. uni.hideLoading();
  240. this.loading = false;
  241. }, 1000)
  242. })
  243. },
  244. // 点击取消按钮
  245. clear() {
  246. this.current = 0
  247. console.log("@@")
  248. },
  249. search() {
  250. this.$u.route({
  251. url: 'pages/me/search/index',
  252. })
  253. },
  254. change(index) {
  255. this.current = index;
  256. if (this.current == 1) {
  257. this.showBrand = true
  258. this.datalist= []
  259. } else if (this.current == 2) {
  260. this.showDate = true
  261. this.datalist= []
  262. }
  263. this.current1 = 1
  264. this.datalist= []
  265. this.data()
  266. }
  267. },
  268. onReachBottom() {
  269. console.log("@@@")
  270. console.log(this.count)
  271. console.log(this.datalength)
  272. setTimeout(() => {
  273. if (this.count > this.datalength) {
  274. this.current1 = ++this.current1;
  275. this.data()
  276. this.status = 'nomore'
  277. } else {
  278. this.status = 'loading';
  279. console.log("@@@")
  280. // this.status = 'nomore'
  281. }
  282. }, 1000)
  283. }
  284. }
  285. </script>
  286. <style lang="scss" scoped>
  287. .header {
  288. height: 400rpx;
  289. width: 100%;
  290. background: #0094FE;
  291. color: #fff;
  292. font-size: 28rpx;
  293. }
  294. .header-one {
  295. text-align: center;
  296. padding-top: 10rpx;
  297. }
  298. .header-one>text {
  299. font-size: 52rpx;
  300. }
  301. .content {
  302. display: flex;
  303. justify-content: space-between;
  304. width: 700rpx;
  305. margin-top: 80rpx;
  306. }
  307. .content-one {
  308. width: 690rpx;
  309. height: 305rpx;
  310. background: #FFFFFF;
  311. box-shadow: 0px 0px 24px 0px rgba(101, 176, 249, 0.41);
  312. border-radius: 20rpx;
  313. margin: 0 auto;
  314. margin-top: 30rpx;
  315. }
  316. .content-one-view {
  317. width: 6rpx;
  318. height: 30rpx;
  319. background: #0292FD;
  320. position: relative;
  321. top: 20rpx;
  322. left: 30rpx;
  323. }
  324. .content-one-text {
  325. position: relative;
  326. top: -8rpx;
  327. left: 60rpx;
  328. font-size: 24rpx;
  329. font-weight: bold;
  330. color: #000;
  331. }
  332. .content-one-time {
  333. position: relative;
  334. top: -40rpx;
  335. left: 530rpx;
  336. font-size: 13rpx;
  337. color: #626262;
  338. }
  339. .content-two {
  340. display: flex;
  341. justify-content: space-between;
  342. font-size: 24rpx;
  343. color: #6A6A6A;
  344. margin-top: 25rpx;
  345. margin-left: 30rpx;
  346. margin-right: 30rpx;
  347. }
  348. </style>