record.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <view class="record">
  3. <view class="top"></view>
  4. <view class="head">
  5. <span class="cuIcon-back" @click="back"></span>
  6. <view class="case">
  7. 核销记录
  8. </view>
  9. </view>
  10. <view class="select">
  11. <view class="moun" @click="show = true">
  12. <image src="/static/scan/screen.png" mode=""></image>
  13. {{showMonth}}
  14. </view>
  15. <u-select v-model="show" :list="timelist" @confirm="confirm"></u-select>
  16. <view class="search">
  17. <image src="/static/index/search.png" mode=""></image>
  18. <u-input type="text" v-model="productName" placeholder="请输入关键词" />
  19. <span @click="searchList">搜索</span>
  20. </view>
  21. <!-- <u-dropdown>
  22. <u-dropdown-item v-model="month" title="一月" :options="options1"></u-dropdown-item>
  23. </u-dropdown> -->
  24. </view>
  25. <mescroll-uni class="list" :fixed="false" ref="mescrollRef" @up="getList" @init="mescrollInit" :use="false">
  26. <view class="item" v-for="(item,index) in list" :key="index" @click="goDetail(item)">
  27. <view class="time">
  28. {{item.writeOffTime}}核销
  29. </view>
  30. <view class="product">
  31. <view class="img">
  32. <image :src="item.productImage" mode=""></image>
  33. </view>
  34. <view class="name">
  35. {{item.productName}}<br />
  36. <span>¥{{item.price}}</span>
  37. </view>
  38. <!-- <view class="right">
  39. <image :src="item.url" mode=""></image>
  40. {{item.yhmc}}
  41. </view> -->
  42. </view>
  43. <view class="user">
  44. <view class="left">
  45. {{item.buyTime}}购买
  46. </view>
  47. <view class="right">
  48. <view class="img">
  49. <image :src="item.userAvatar" mode=""></image>
  50. </view>
  51. {{item.userNick}}
  52. </view>
  53. </view>
  54. </view>
  55. </mescroll-uni>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. data() {
  61. return {
  62. showMonth: '',
  63. keyword: '',
  64. month: '',
  65. merchantId: '',
  66. productName: '',
  67. options1: [],
  68. list: [],
  69. upOption: {
  70. page: {
  71. num: 0,
  72. size: 10 // 每页数据的数量,默认10
  73. },
  74. noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  75. empty: {
  76. tip: '暂无相关数据'
  77. },
  78. },
  79. show: false,
  80. writeOffTimeStart: '',
  81. writeOffTimeEnd: '',
  82. timelist: [{
  83. label: "一月",
  84. value: 1,
  85. },
  86. {
  87. label: "二月",
  88. value: 2,
  89. },
  90. {
  91. label: "三月",
  92. value: 3,
  93. },
  94. {
  95. label: "四月",
  96. value: 4,
  97. },
  98. {
  99. label: "五月",
  100. value: 5,
  101. },
  102. {
  103. label: "六月",
  104. value: 6,
  105. },
  106. {
  107. label: "七月",
  108. value: 7,
  109. },
  110. {
  111. label: "八月",
  112. value: 8,
  113. },
  114. {
  115. label: "九月",
  116. value: 9,
  117. },
  118. {
  119. label: "十月",
  120. value: 10,
  121. },
  122. {
  123. label: "十一月",
  124. value: 11,
  125. },
  126. {
  127. label: "十二月",
  128. value: 12,
  129. },
  130. ]
  131. }
  132. },
  133. methods: {
  134. mescrollInit(mescroll) {
  135. this.mescroll = mescroll;
  136. },
  137. //返回
  138. back() {
  139. uni.navigateBack({
  140. delta: 1
  141. });
  142. },
  143. getList(page) {
  144. let data = {
  145. merchantId: uni.getStorageSync('login_user_info').merchantId,
  146. productName: this.productName,
  147. pageNo: page.num,
  148. pageSize: page.size,
  149. writeOffTimeEnd: this.writeOffTimeEnd,
  150. writeOffTimeStart: this.writeOffTimeStart
  151. }
  152. console.log(data.merchantId)
  153. this.$http.post("/app/writeOff/list", data).then(res => {
  154. if (res.data.code == 200 && res.data.result.records.length>0) {
  155. this.list = this.list.concat(res.data.result.records)
  156. this.mescroll.endSuccess(res.data.result.records.length, res.data.result.total);
  157. }else{
  158. this.mescroll.endErr()
  159. }
  160. })
  161. .catch(()=>{
  162. this.mescroll.endErr()
  163. })
  164. },
  165. searchList() {
  166. this.list = []
  167. let page = {
  168. num: 1,
  169. size: 10
  170. }
  171. this.getList(page)
  172. },
  173. goDetail(item) {
  174. uni.navigateTo({
  175. url: '/pages/scan/check'
  176. })
  177. },
  178. confirm(e) {
  179. console.log(e)
  180. this.showMonth = e[0].label
  181. let num = e[0].value
  182. this.getMonthRange(num)
  183. this.list = []
  184. let page = {
  185. num: 1,
  186. size: 10,
  187. };
  188. this.getList(page);
  189. },
  190. getMonthRange(monthValue) {
  191. let year = new Date().getFullYear();
  192. const startDate = new Date(year, monthValue - 1, 1);
  193. const endDate = new Date(year, monthValue, 0);
  194. endDate.setHours(23, 59, 59, 999);
  195. this.writeOffTimeStart = `${year}-${String(monthValue).padStart(2, '0')}-01 00:00:00`;
  196. this.writeOffTimeEnd = `${year}-${String(monthValue).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')} 23:59:59`;
  197. }
  198. },
  199. mounted() {
  200. this.mescroll.optDown.use = false
  201. // this.getList()
  202. },
  203. onShow() {
  204. let that = this
  205. const date = new Date();
  206. let currentMonth = new Date().getMonth();
  207. that.showMonth = that.timelist[currentMonth].label;
  208. console.log(that.showMonth)
  209. that.getMonthRange(that.timelist[currentMonth].value)
  210. }
  211. }
  212. </script>
  213. <style lang="scss" scoped>
  214. .record {
  215. width: 100%;
  216. height: 100vh;
  217. display: flex;
  218. flex-direction: column;
  219. background: #F7F8FC;
  220. /*#ifdef APP-PLUS*/
  221. .top {
  222. width: 100%;
  223. height: var(--status-bar-height);
  224. background: #fff;
  225. }
  226. /*#endif*/
  227. .head {
  228. width: 100%;
  229. height: 112rpx;
  230. padding: 20rpx;
  231. display: flex;
  232. align-items: center;
  233. background: #fff;
  234. position: relative;
  235. .cuIcon-back {
  236. font-size: 40rpx;
  237. margin-right: 40rpx;
  238. }
  239. .case {
  240. position: absolute;
  241. left: 50%;
  242. transform: translateX(-50%);
  243. font-size: 36rpx;
  244. font-weight: 600;
  245. }
  246. }
  247. .select {
  248. width: 100%;
  249. height: 88rpx;
  250. padding: 0px 32rpx;
  251. display: flex;
  252. align-items: center;
  253. justify-content: space-between;
  254. background: #ffffff;
  255. border-top: 1px solid #eeeeee;
  256. border-bottom: 1px solid #eeeeee;
  257. .moun {
  258. width: 149rpx;
  259. height: 56rpx;
  260. background: #F7F8FC;
  261. border-radius: 12rpx;
  262. display: flex;
  263. align-items: center;
  264. padding: 0px 12rpx;
  265. image {
  266. width: 36rpx;
  267. height: 36rpx;
  268. margin-right: 12rpx;
  269. }
  270. }
  271. .search {
  272. width: 483rpx;
  273. height: 55rpx;
  274. background: #F7F8FC;
  275. border-radius: 12rpx;
  276. padding: 0rpx 20rpx;
  277. display: flex;
  278. align-items: center;
  279. justify-content: space-between;
  280. image {
  281. width: 36rpx;
  282. height: 36rpx;
  283. }
  284. input {
  285. // height: 36rpx;
  286. font-size: 26rpx;
  287. }
  288. span {
  289. font-size: 26rpx;
  290. color: #333333;
  291. }
  292. }
  293. }
  294. .list {
  295. flex: 1;
  296. overflow-y: auto;
  297. margin-top: 3rpx;
  298. .item {
  299. width: 100%;
  300. background-color: #fff;
  301. margin-bottom: 20rpx;
  302. padding: 20rpx 32rpx;
  303. border-radius: 20rpx;
  304. .time {
  305. font-size: 26rpx;
  306. color: #6B6E79;
  307. }
  308. .product {
  309. display: flex;
  310. // justify-content: space-between;
  311. margin-top: 20rpx;
  312. .img {
  313. width: 128rpx;
  314. height: 128rpx;
  315. border-radius: 12rpx;
  316. overflow: hidden;
  317. margin-right: 16rpx;
  318. image {
  319. width: 128rpx;
  320. height: 128rpx;
  321. }
  322. }
  323. .name {
  324. display: flex;
  325. flex-direction: column;
  326. justify-content: space-between;
  327. span {
  328. font-size: 22rpx;
  329. color: #FD4912;
  330. }
  331. }
  332. }
  333. .user {
  334. display: flex;
  335. align-items: center;
  336. justify-content: space-between;
  337. margin-top: 20rpx;
  338. .left {
  339. font-size: 24rpx;
  340. color: #8A91A8;
  341. }
  342. .right {
  343. font-size: 24rpx;
  344. color: #8A91A8;
  345. display: flex;
  346. align-items: center;
  347. .img {
  348. width: 40rpx;
  349. height: 40rpx;
  350. border-radius: 50%;
  351. overflow: hidden;
  352. margin-right: 8rpx;
  353. image {
  354. width: 40rpx;
  355. height: 40rpx;
  356. }
  357. }
  358. }
  359. }
  360. }
  361. }
  362. }
  363. </style>