index.vue 8.6 KB

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