replenishmentRecord.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="container">
  3. <u-navbar leftIconColor="#fff" titleStyle="color:#fff;fontSize:36rpx;" :autoBack="true" bgColor="#2C6FF3"
  4. :placeholder="true" title="补货记录"></u-navbar>
  5. <view class="search">
  6. <u-search :clearabled="true" v-model="page.deviceId" placeholder='输入设备ID进行搜索' :showAction="true"
  7. actionText="搜索" @custom='custom'></u-search>
  8. </view>
  9. <view class="flex align-center justify-between margin">
  10. <view class="flex align-center">
  11. <view class="flex align-center time">
  12. <view class="" @tap="replenishmentdate('start')">{{dateStart?dateStart:'创建时间开始'}}</view>
  13. <view class="">至</view>
  14. <view class="" @tap="replenishmentdate('end')">{{dateend?dateend:'创建时间结束'}}</view>
  15. </view>
  16. <image class="date-image" src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/date.png" mode="widthFix"></image>
  17. </view>
  18. <view class="flex align-center" @tap="pickershow=true">
  19. <view class="" style="font-size: 26rpx;">{{isopen?isopen:'是否开门'}}</view>
  20. <image src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/selectIcon.png" mode="aspectFit"
  21. style="width:24rpx;height: 24rpx;margin-left: 8rpx;"></image>
  22. <!-- <view class="filter">筛选</view> -->
  23. </view>
  24. </view>
  25. <scroll-view v-if="isEmpty===false" class="scrollview" :scroll-with-animation="true" scroll-y lower-threshold="100" :style="{'height':fullHeight}">
  26. <view class="replenishmentrecord-container" v-for="item in replenishmentList" :key="item.id" @tap="details(item)">
  27. <view class="flex align-center justify-between">
  28. <view class="">商户ID:{{item.mercId}}</view>
  29. <view class="">
  30. <u-tag v-if="!item.isOpenDoor" text="补货" type="error"></u-tag>
  31. <u-tag v-else text="开门补货"></u-tag>
  32. </view>
  33. </view>
  34. <view class="flex">设备ID:{{item.deviceId}}</view>
  35. <view class="flex" v-if="item.urlVideo0">视频路径:{{item.urlVideo0}}</view>
  36. <view class="flex" v-if="item.urlVideo1">视频路径:{{item.urlVideo1}}</view>
  37. <view class="flex">创建人姓名:{{item.createUserName}}</view>
  38. <view class="flex">创建时间:{{item.createTime}}</view>
  39. </view>
  40. </scroll-view>
  41. <view v-if="isEmpty===true" class='empty'>
  42. <u-empty mode="data" text="数据为空"></u-empty>
  43. </view>
  44. <u-picker title='是否开门' :show="pickershow" :columns="isOpenDoor" keyName="value" @confirm="pickerconfirm"
  45. @cancel='pickerclose'></u-picker>
  46. <u-datetime-picker :show="show" :closeOnClickOverlay="true" mode="date" @confirm="confirm" @cancel="close" v-model="timeStamp"></u-datetime-picker>
  47. </view>
  48. </template>
  49. <script>
  50. import {
  51. page
  52. } from "@/api/replenishment/replenishment.js"
  53. export default {
  54. data() {
  55. return {
  56. page: {
  57. deviceId: '',
  58. isOpenDoor: '',
  59. beginCreateTime: '',
  60. endCreateTime: ''
  61. },
  62. dateStart: '',
  63. dateend: '',
  64. type: '',
  65. replenishmentList: [],
  66. mode: 'range',
  67. show: false,
  68. pickershow: false,
  69. date: [],
  70. index: 1,
  71. isopen: '',
  72. isEmpty: false,
  73. isOpenDoor: [
  74. [{
  75. type: '',
  76. value: '全部'
  77. },
  78. {
  79. type: true,
  80. value: '是'
  81. }, {
  82. type: false,
  83. value: '否'
  84. }
  85. ],
  86. ],
  87. timeStamp: new Date(), //时间picker显示时间
  88. }
  89. },
  90. onLoad(o) {
  91. if(o.id){
  92. this.page.deviceId=o.id
  93. }
  94. this.currentDate = new Date();
  95. this.currentDate = new Date();
  96. this.dateStart = uni.$u.timeFormat(this.currentDate, 'yyyy-mm-dd')
  97. this.dateend = uni.$u.timeFormat(this.currentDate, 'yyyy-mm-dd')
  98. this.page.beginCreateTime = this.dateStart + ' 00:00:00'
  99. this.page.endCreateTime = this.dateend + ' 23:59:59'
  100. this.getPage()
  101. },
  102. methods: {
  103. franchiseePickerChange(e) {
  104. this.index = e.detail.value
  105. },
  106. replenishmentdate(type) {
  107. if (type == 'start') {
  108. this.type = type
  109. }
  110. if (type == 'end') {
  111. this.type = type
  112. }
  113. this.show = true
  114. },
  115. close() {
  116. this.show = false
  117. },
  118. confirm(e) {
  119. if (this.type == 'start') {
  120. this.dateStart = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
  121. this.page.beginCreateTime = this.dateStart + ' 00:00:00'
  122. }
  123. if (this.type == 'end') {
  124. this.dateend = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
  125. this.page.endCreateTime = this.dateend+ ' 23:59:59'
  126. }
  127. if(this.dateStart>this.dateend){
  128. uni.$u.toast('开始日期不能大于结束日期')
  129. return;
  130. }
  131. this.getPage()
  132. this.show = false
  133. },
  134. custom() {
  135. this.getPage()
  136. },
  137. pickerconfirm(e) {
  138. this.isopen = e.value[0].value
  139. this.page.isOpenDoor = e.value[0].type
  140. this.getPage()
  141. this.pickershow = false
  142. },
  143. pickerclose() {
  144. this.pickershow = false
  145. },
  146. // 补货详情
  147. details(val) {
  148. this.$tab.navigateTo('replenishmentRecordDetails?id=' + val.id)
  149. },
  150. getPage() {
  151. page({
  152. page: {
  153. size: -1,
  154. },
  155. "deviceId": this.page.deviceId,
  156. "isOpenDoor": this.page.isOpenDoor,
  157. "beginCreateTime": this.page.beginCreateTime,
  158. "endCreateTime": this.page.endCreateTime
  159. }).then(res => {
  160. if (res.data.page == null) {
  161. this.isEmpty = true
  162. }
  163. this.replenishmentList = res.data.records;
  164. this.isEmpty = this.replenishmentList.length == 0;
  165. })
  166. }
  167. }
  168. }
  169. </script>
  170. <style>
  171. page {
  172. background-color: #f7f7f7;
  173. }
  174. </style>
  175. <style lang="scss" scoped>
  176. .container {
  177. .margintop {
  178. margin-top: 20rpx;
  179. }
  180. .marleft {
  181. margin-left: 10rpx;
  182. }
  183. .scrollview {
  184. }
  185. .empty {
  186. margin-top: 120rpx
  187. }
  188. .search {
  189. padding: 24rpx 24rpx;
  190. background-color: #fff;
  191. }
  192. .time {
  193. font-size: 26rpx;
  194. font-weight: 400;
  195. color: #333440;
  196. }
  197. .date-image {
  198. width: 30rpx;
  199. margin-left: 10rpx;
  200. }
  201. .filter {
  202. font-size: 26rpx;
  203. font-weight: 400;
  204. color: #000000;
  205. margin-left: 22rpx;
  206. }
  207. .date {
  208. margin-left: 10rpx;
  209. padding: 15rpx;
  210. border-radius: 15rpx;
  211. background-color: #fff;
  212. }
  213. .magin {
  214. margin: 10rpx 20rpx;
  215. }
  216. .replenishmentrecord-container {
  217. background-color: #fff;
  218. padding: 20rpx;
  219. border-radius: 15rpx;
  220. margin:0 20rpx 20rpx 20rpx;
  221. box-shadow: 0 5rpx 4rpx rgba(179, 179, 179, 0.3);
  222. }
  223. }
  224. </style>