code_record.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <template>
  2. <view class="record">
  3. <view class="search">
  4. <view class="search_box flexS">
  5. <text class="iconfont iconsearch"></text>
  6. <input type="text" placeholder="输入昵称或手机号" v-model="params.search_name">
  7. <view class="flexS">
  8. <text class="iconfont iconguanbi1" @click="params.search_name='',toSearch(0)"></text>
  9. <view class="btn" @click="toSearch(1)">查询</view>
  10. </view>
  11. </view>
  12. <view class="date_box flexB">
  13. <view class="flexC">
  14. <text>起始时间</text>
  15. <picker mode="date" @change="toChangeStartTime">
  16. <view class="value">{{ params.start_time | dateFormatter('yyyy-MM-dd') }}</view>
  17. </picker>
  18. <text class="iconfont iconzhcc_xiangxiajiantou"></text>
  19. </view>
  20. <view class="flexC">
  21. <text>结束时间</text>
  22. <picker mode="date" @change="toChangeEndTime">
  23. <view class="value">{{ params.end_time | dateFormatter('yyyy-MM-dd') }}</view>
  24. </picker>
  25. <text class="iconfont iconzhcc_xiangxiajiantou"></text>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="record_box flexB" v-if="codeList.length>0">
  30. <view>发货记录</view>
  31. <view>
  32. <text style="font-size:28rpx;">共发货:</text>
  33. <text style="font-size:44rpx;color:#FB231F;">{{total}}</text>
  34. <text style="font-size:28rpx;color:#FB231F;">套</text>
  35. </view>
  36. </view>
  37. <view class="list">
  38. <view class="list_con" v-for="item in codeList" :key="item.id">
  39. <view class="user flexS">
  40. <view class="out flexCC">
  41. <view class="in"></view>
  42. </view>
  43. <view>客户:{{item.accept&&item.accept.nickname}}</view>
  44. </view>
  45. <view class="goods_box" v-for="(temp,idx) in item.goods" :key="idx">
  46. <view class="flexB goods" @click="temp.isChange=!temp.isChange">
  47. <view class="goods_con">
  48. <view class="goods_name">{{temp.goods_name}}</view>
  49. <view class="goods_num">
  50. <text>尺码:{{temp.skus.length}}</text>
  51. <text style="margin-left:20rpx;">数量:{{temp.skus.reduce((t, e) => t + e.num, 0)}}</text>
  52. </view>
  53. </view>
  54. <view style="width:100rpx;height:100rpx;" class="flexC">
  55. <text class="store_icon icon-jiantou2" v-if="temp.isChange"></text>
  56. <text class="store_icon icon-jiantou3" v-else></text>
  57. </view>
  58. </view>
  59. <view class="goods_info" v-if="temp.isChange">
  60. <view class="goods_intr flexB">
  61. <view>规格</view>
  62. <view>尺码</view>
  63. <view>数量</view>
  64. </view>
  65. <view class="goods_detail flexB" v-for="(sku,index) in temp.skus" :key="index">
  66. <view>{{sku.sex===1?'男款':'女款'}}</view>
  67. <view>{{sku.size}}</view>
  68. <view>{{sku.num}}</view>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="time">发货时间:{{item.created_at}}</view>
  73. </view>
  74. <view class="noData" v-if="codeList.length===0">
  75. <image src="../../static/default/no_card.png" mode=""></image>
  76. <view>--暂无数据--</view>
  77. </view>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. import {
  83. getScanLog
  84. } from '@/apis/stock.js';
  85. import {
  86. dateFormatter
  87. } from "@/filters/index.js"
  88. export default {
  89. data() {
  90. return {
  91. params: {
  92. page_index: 1,
  93. page_size: 20,
  94. start_time: dateFormatter(Date.now(), 'yyyy-MM-dd'),
  95. end_time: dateFormatter(Date.now(), 'yyyy-MM-dd'),
  96. search_name: ''
  97. },
  98. codeList: [],
  99. totalPage: 0,
  100. total: 0 //总套数
  101. }
  102. },
  103. onShow() {
  104. this.getLog()
  105. },
  106. onReachBottom() {
  107. this.getMoreLog()
  108. },
  109. methods: {
  110. getLog(isMore) {
  111. uni.showLoading({
  112. title: '加载中....'
  113. })
  114. let {
  115. page_index,
  116. page_size,
  117. start_time,
  118. end_time,
  119. search_name
  120. } = this.params
  121. getScanLog({
  122. start_time: start_time + ' 00:00:00',
  123. end_time: end_time + ' 23:59:59',
  124. page_index,
  125. page_size,
  126. search_name
  127. }).then(res => {
  128. if (res.code === 200) {
  129. this.total = res.data.list.num
  130. let list = res.data.list.info
  131. list.map(i => {
  132. i.goods.map(j => {
  133. this.$set(j, 'isChange', false)
  134. this.$set(j, 'goods_name', this.getStyle(j.name))
  135. })
  136. })
  137. this.codeList = isMore ? this.codeList.concat(list) : list
  138. this.totalPage = Math.ceil(res.data.total / this.params.page_size);
  139. } else {
  140. uni.showModal({
  141. content: res.data || '暂无数据',
  142. showCancel: false
  143. })
  144. }
  145. uni.hideLoading()
  146. }).catch(err => {
  147. uni.showModal({
  148. content: err,
  149. showCancel: false
  150. })
  151. })
  152. },
  153. getMoreLog() {
  154. if (this.params.page_index >= this.totalPage) {
  155. uni.showToast({
  156. title: '没有更多啦~',
  157. icon: 'none'
  158. });
  159. return false;
  160. }
  161. this.params.page_index++;
  162. this.getLog(true)
  163. },
  164. // 款式
  165. getStyle(v) {
  166. if (v == '精装版') {
  167. return '大卫博士健康内裤(精装版)'
  168. } else if (v === '简约版') {
  169. return '大卫博士健康内裤(简约版)'
  170. } else if (v === '高腰版') {
  171. return '大卫博士健康内裤(高腰版)'
  172. } else if (v === '纯棉版') {
  173. return '大卫博士健康内裤(纯棉版)'
  174. } else if (v === '精装赠') {
  175. return '大卫博士健康内裤(精装赠)'
  176. } else if (v === '青春版') {
  177. return '大卫博士健康内裤(青春版)'
  178. }
  179. },
  180. // 开始时间
  181. toChangeStartTime(e) {
  182. let now = e.detail.value
  183. let {
  184. start_time,
  185. end_time
  186. } = this.params
  187. if (new Date(now).getTime() > new Date(end_time).getTime()) {
  188. uni.showModal({
  189. content: "起始时间不能大于结束时间",
  190. showCancel: false
  191. })
  192. return false
  193. }
  194. this.params.start_time = e.detail.value
  195. this.toSearch(0)
  196. },
  197. // 结束时间
  198. toChangeEndTime(e) {
  199. let now = e.detail.value
  200. let {
  201. start_time,
  202. end_time
  203. } = this.params
  204. if (new Date(now).getTime() < new Date(start_time).getTime()) {
  205. uni.showModal({
  206. content: "结束时间不能小于起始时间",
  207. showCancel: false
  208. })
  209. return false
  210. }
  211. this.params.end_time = e.detail.value
  212. this.toSearch(0)
  213. },
  214. // 查询
  215. toSearch(type) {
  216. if (type === 1 && !this.params.search_name) {
  217. uni.showModal({
  218. content: '请先输入昵称或手机号',
  219. showCancel: false
  220. })
  221. return
  222. }
  223. this.params.page_index = 1
  224. this.getLog()
  225. },
  226. }
  227. }
  228. </script>
  229. <style lang="scss" scoped>
  230. .record {
  231. padding-bottom: 120rpx;
  232. .search {
  233. width: 100%;
  234. // height: 184rpx;
  235. background: #fff;
  236. padding: 20rpx 0 24rpx 0;
  237. .search_box {
  238. width: 702rpx;
  239. height: 80rpx;
  240. margin: 0 auto;
  241. background: #F9F9FB;
  242. border-radius: 40rpx;
  243. padding: 0 10rpx 0 24rpx;
  244. box-sizing: border-box;
  245. .iconfont {
  246. font-size: 50rpx;
  247. color: #999;
  248. }
  249. .iconguanbi1 {
  250. color: #ccc;
  251. margin-right: 10rpx;
  252. }
  253. input {
  254. padding-left: 10rpx;
  255. width: 65%;
  256. height: 100%;
  257. }
  258. .btn {
  259. width: 132rpx;
  260. height: 64rpx;
  261. background: linear-gradient(92deg, #FF232C 0%, #FF571B 100%);
  262. border-radius: 40rpx;
  263. color: #fff
  264. }
  265. }
  266. .date_box {
  267. margin-top: 32rpx;
  268. >view {
  269. width: 50%;
  270. text-align: center;
  271. text {
  272. font-size: 28rpx;
  273. }
  274. .iconfont {
  275. font-size: 20rpx;
  276. color: #999;
  277. }
  278. picker {
  279. margin: 0 20rpx;
  280. view {
  281. color: #999;
  282. }
  283. }
  284. }
  285. }
  286. .time {
  287. width: 468rpx;
  288. height: 68rpx;
  289. border-radius: 68rpx;
  290. background-color: #ffffff;
  291. padding: 0 34rpx;
  292. box-sizing: border-box;
  293. line-height: 68rpx;
  294. font-size: 28rpx;
  295. display: flex;
  296. align-items: center;
  297. justify-content: space-between;
  298. .value {
  299. color: #999999;
  300. letter-spacing: 1px;
  301. }
  302. .fixed {
  303. color: #333333;
  304. }
  305. }
  306. .btn {
  307. width: 192rpx;
  308. height: 68rpx;
  309. border-radius: 68rpx;
  310. text-align: center;
  311. line-height: 68rpx;
  312. color: #FFFFFF;
  313. font-size: 28rpx;
  314. background: linear-gradient(to right, #F97C55 0%, #F44545 100%);
  315. }
  316. }
  317. .record_box {
  318. width: 702rpx;
  319. margin: 0 auto;
  320. padding-top: 24rpx;
  321. box-sizing: border-box;
  322. >view {
  323. font-size: 32rpx;
  324. font-weight: bold;
  325. }
  326. }
  327. .list {
  328. width: 100%;
  329. .list_con {
  330. padding: 0 24rpx;
  331. margin: 24rpx auto 0;
  332. background: #fff;
  333. box-sizing: border-box;
  334. .user {
  335. height: 88rpx;
  336. line-height: 88rpx;
  337. .out {
  338. width: 30rpx;
  339. height: 30rpx;
  340. background: rgba(234, 74, 65, 0.39);
  341. border-radius: 50%;
  342. margin-right: 20rpx;
  343. .in {
  344. width: 18rpx;
  345. height: 18rpx;
  346. background: #EA4A41;
  347. border-radius: 50%;
  348. }
  349. }
  350. }
  351. .goods_box {
  352. padding: 24rpx 0;
  353. border-top: 2rpx solid #EEEEEE;
  354. border-bottom: 2rpx solid #EEEEEE;
  355. .goods {
  356. .goods_con {
  357. display: flex;
  358. flex-direction: column;
  359. align-items: flex-start;
  360. .goods_name {
  361. font-size: 32rpx;
  362. font-weight: bold;
  363. margin-bottom: 20rpx;
  364. }
  365. .goods_num {
  366. min-width: 245rpx;
  367. padding: 10rpx;
  368. box-sizing: border-box;
  369. background: #F9F9FB;
  370. border-radius: 4rpx;
  371. text {
  372. color: #999;
  373. }
  374. }
  375. }
  376. .store_icon {
  377. font-size: 35rpx;
  378. }
  379. }
  380. .goods_info {
  381. margin-top: 32rpx;
  382. .goods_detail,
  383. .goods_intr {
  384. >view {
  385. width: 120rpx;
  386. text-align: center;
  387. }
  388. }
  389. .goods_detail {
  390. margin-top: 24rpx;
  391. height: 72rpx;
  392. background: #F9F9FB;
  393. border-radius: 8rpx;
  394. }
  395. }
  396. }
  397. .time {
  398. height: 98rpx;
  399. line-height: 98rpx;
  400. }
  401. }
  402. }
  403. }
  404. </style>