index.vue 8.4 KB

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