index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  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 :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. <u-loadmore :status="status" />
  54. </view>
  55. <view v-else style="margin-top: 400rpx;">
  56. <u-empty text="暂无数据" mode="list"></u-empty>
  57. </view>
  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. list: [{
  72. name: '全部'
  73. }, {
  74. name: '品牌'
  75. }, {
  76. name: '时间',
  77. }],
  78. itemList: [{
  79. head: "赛轮 12R22.5 18PR S838",
  80. body: "12R22.5 152/149K 18PR S838 LBGSL 0L",
  81. open: true,
  82. disabled: true
  83. }, {
  84. head: "赛轮 12R22.5 18PR S838",
  85. body: "12R22.5 152/149K 18PR S838 LBGSL 0L",
  86. open: false,
  87. }, {
  88. head: "赛轮 12R22.5 18PR S838",
  89. body: "12R22.5 152/149K 18PR S838 LBGSL 0L",
  90. open: false,
  91. }],
  92. brandList:JSON.parse(JSON.stringify([])),
  93. // brandList: [{
  94. // value: '1',
  95. // label: '赛轮'
  96. // },
  97. // {
  98. // value: '2',
  99. // label: '黑鹰'
  100. // }
  101. // ],
  102. current: 0,
  103. // 默认页数
  104. current1: 1,
  105. showBrand: false,
  106. showDate: false,
  107. mode: 'range',
  108. // 开始时间
  109. startTime: '',
  110. // 结束时间
  111. endTime: '',
  112. pages: '',
  113. count:'',
  114. datalength: '',
  115. label: '',
  116. };
  117. },
  118. created() {
  119. this.data()
  120. this.getBrandList()
  121. },
  122. methods: {
  123. // 获取奖励明细
  124. data() {
  125. request({
  126. url: '/myPage/getPageScanRewordList',
  127. method: 'post',
  128. data: {
  129. storeId:this.$store.state.storeInfo.storeId,
  130. userId:this.$store.state.storeInfo.userId,
  131. 'current': this.current1,
  132. 'size': '10'
  133. }
  134. }).then(res => {
  135. console.log(res)
  136. // this.datalist = res.data.data
  137. this.count = res.data.count
  138. this.datalength = res.data.data.length
  139. this.datalist = this.datalist.concat(res.data.data)
  140. // 判断扫码类型
  141. for (var i = 0; i < res.data.data.length; i++) {
  142. if (res.data.data[i].getWay == 0) {
  143. this.getWay = "车主扫码"
  144. } else {
  145. this.getWay = "门店扫码"
  146. }
  147. }
  148. }).catch(err => {
  149. console.log(err)
  150. })
  151. .finally(() => {
  152. setTimeout(() => {
  153. uni.hideLoading();
  154. this.loading = false;
  155. }, 1000)
  156. })
  157. },
  158. // 时间选择器获取时间
  159. changetime(e) {
  160. console.log(e)
  161. this.startTime = e.startDate
  162. this.endTime = e.endDate
  163. this.datalist= []
  164. request({
  165. url: '/myPage/getPageScanRewordList',
  166. method: 'post',
  167. data: {
  168. storeId:this.$store.state.storeInfo.storeId,
  169. userId:this.$store.state.storeInfo.userId,
  170. 'current': '1',
  171. 'size': '10',
  172. 'startTime': this.startTime +' 00:00:00',
  173. 'endTime': this.endTime +' 00:00:00'
  174. }
  175. }).then(res => {
  176. console.log(res)
  177. // this.datalist = res.data.data
  178. this.datalist = this.datalist.concat(res.data.data)
  179. console.log(res.data.data)
  180. console.log(this.datalist)
  181. this.count = res.data.count
  182. // 判断扫码类型
  183. for (var i = 0; i < res.data.data.length; i++) {
  184. if (res.data.data[i].getWay == 0) {
  185. this.getWay = "车主扫码"
  186. } else {
  187. this.getWay = "门店扫码"
  188. }
  189. }
  190. console.log(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. getBrandList() {
  203. request({
  204. url: '/baseReq/getBrandList',
  205. method: 'post',
  206. data: {
  207. storeId:this.$store.state.storeInfo.storeId,
  208. userId:this.$store.state.storeInfo.userId
  209. }
  210. }).then(res => {
  211. this.brandList = JSON.parse(JSON.stringify(res.data.data))
  212. }).catch(err => {
  213. console.log(err)
  214. })
  215. .finally(() => {
  216. setTimeout(() => {
  217. uni.hideLoading();
  218. this.loading = false;
  219. }, 1000)
  220. })
  221. },
  222. // 点击获取品牌
  223. confirm(e) {
  224. console.log(e)
  225. console.log(e[0].label)
  226. this.label = e[0].label
  227. request({
  228. url: '/myPage/getPageScanRewordList',
  229. method: 'post',
  230. data: {
  231. storeId:this.$store.state.storeInfo.storeId,
  232. userId:this.$store.state.storeInfo.userId,
  233. 'current': '1',
  234. 'size': '10',
  235. 'searchKey': this.label
  236. }
  237. }).then(res => {
  238. console.log(res)
  239. this.count = res.data.count
  240. this.datalength = res.data.data.length
  241. this.datalist = this.datalist.concat(res.data.data)
  242. // 判断扫码类型
  243. for (var i = 0; i < res.data.data.length; i++) {
  244. if (res.data.data[i].getWay == 0) {
  245. this.getWay = "车主扫码"
  246. } else {
  247. this.getWay = "门店扫码"
  248. }
  249. }
  250. console.log(res.data.data)
  251. }).catch(err => {
  252. console.log(err)
  253. })
  254. .finally(() => {
  255. setTimeout(() => {
  256. uni.hideLoading();
  257. this.loading = false;
  258. }, 1000)
  259. })
  260. },
  261. // 点击取消按钮
  262. clear() {
  263. this.current = 0
  264. console.log("@@")
  265. },
  266. search() {
  267. this.$u.route({
  268. url: 'pages/me/search/index',
  269. })
  270. },
  271. change(index) {
  272. this.current = index;
  273. if (this.current == 1) {
  274. this.showBrand = true
  275. this.datalist= []
  276. } else if (this.current == 2) {
  277. this.showDate = true
  278. this.datalist= []
  279. }
  280. this.current1 = 1
  281. this.datalist= []
  282. this.data()
  283. }
  284. },
  285. onReachBottom() {
  286. console.log("@@@")
  287. console.log(this.count)
  288. console.log(this.datalength)
  289. setTimeout(() => {
  290. if (this.count > this.datalength) {
  291. this.current1 = ++this.current1;
  292. this.data()
  293. this.status = 'nomore'
  294. } else {
  295. this.status = 'loading';
  296. console.log("@@@")
  297. // this.status = 'nomore'
  298. }
  299. }, 1000)
  300. }
  301. }
  302. </script>
  303. <style lang="scss" scoped>
  304. .header {
  305. height: 400rpx;
  306. width: 100%;
  307. background: #0094FE;
  308. color: #fff;
  309. font-size: 28rpx;
  310. }
  311. .header-one {
  312. text-align: center;
  313. padding-top: 10rpx;
  314. }
  315. .header-one>text {
  316. font-size: 52rpx;
  317. }
  318. .content {
  319. display: flex;
  320. justify-content: space-between;
  321. width: 700rpx;
  322. margin-top: 80rpx;
  323. }
  324. .content-one {
  325. width: 690rpx;
  326. height: 305rpx;
  327. background: #FFFFFF;
  328. box-shadow: 0px 0px 24px 0px rgba(101, 176, 249, 0.41);
  329. border-radius: 20rpx;
  330. margin: 0 auto;
  331. margin-top: 30rpx;
  332. }
  333. .content-one-view {
  334. width: 6rpx;
  335. height: 30rpx;
  336. background: #0292FD;
  337. position: relative;
  338. top: 20rpx;
  339. left: 30rpx;
  340. }
  341. .content-one-text {
  342. position: relative;
  343. top: -8rpx;
  344. left: 60rpx;
  345. font-size: 24rpx;
  346. font-weight: bold;
  347. color: #000;
  348. }
  349. .content-one-time {
  350. position: relative;
  351. top: -40rpx;
  352. left: 530rpx;
  353. font-size: 13rpx;
  354. color: #626262;
  355. }
  356. .content-two {
  357. display: flex;
  358. justify-content: space-between;
  359. font-size: 24rpx;
  360. color: #6A6A6A;
  361. margin-top: 25rpx;
  362. margin-left: 30rpx;
  363. margin-right: 30rpx;
  364. }
  365. </style>