Inventory.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view>
  3. <!-- 查询 -->
  4. <view class="tabs-view">
  5. <view class="keyword-view clearfix">
  6. <view class="float_left">
  7. <u-search
  8. :show-action="false"
  9. @clear="searchData()"
  10. @search="searchData()"
  11. :clearabled="true"
  12. placeholder="商品名称/条码/编码/单号/制单人"
  13. v-model="search_form.search"
  14. ></u-search>
  15. </view>
  16. <view class="float_right" @click="openSel('search_show')"><text class="custom-icon custom-icon-shaixuan"></text></view>
  17. </view>
  18. </view>
  19. <!-- 内容 -->
  20. <view class="list-ul">
  21. <view class="list-li clearfix" @click="details(item.id)" v-for="(item, index) in outgoing_list" :key="index">
  22. <view class="title clearfix" >
  23. <view class="float_left" style="font-size: 28rpx;font-weight: 700;">{{ item.warehouseName || '--' }}</view>
  24. <view class="float_right">
  25. <text style="margin-right: 10rpx;" v-if="item.auditStatus === 1" class="warning-status">待审核</text>
  26. <text style="margin-right: 10rpx;" v-else class="success-status">已审核</text>
  27. <u-icon name="arrow-right" color="#879BBA" size="28"></u-icon>
  28. </view>
  29. </view>
  30. <view class="list-cont">
  31. <view class="list-cont-li">日期:{{ $u.timeFormat(item.createTime, 'yyyy-mm-dd') }}</view>
  32. <view class="list-cont-li">
  33. 单号:{{ item.no }}
  34. </view>
  35. <view class="list-cont-li clearfix">
  36. <view class="float_left">种类:{{ item.num }}</view>
  37. <view class="float_right">制单人:{{ item.operatorName }}</view>
  38. </view>
  39. </view>
  40. </view>
  41. <addBtn v-if="$accessCheck($Access.inventoryInfoAddStocktaking)" url="/pagesT/stock/AddInventory"></addBtn>
  42. <u-popup v-model="search_show" mode="right">
  43. <view class="search-pop">
  44. <view class="form-view">
  45. <u-form label-width="160rpx" label-position="left">
  46. <u-form-item label-position="top" label="制单日期">
  47. <view class="date-li">
  48. <picker mode="date" @change="bindDateStartChange">
  49. <text class="date-li">{{ search_form.startTime ? $u.timeFormat(search_form.startTime, 'yyyy-mm-dd') : '开始日期' }}</text>
  50. </picker>
  51. </view>
  52. <view class="date-line">-</view>
  53. <view class="date-li">
  54. <picker mode="date" @change="bindDateEndChange">
  55. <text class="date-li">{{ search_form.endTime ? $u.timeFormat(search_form.endTime, 'yyyy-mm-dd') : '结束日期' }}</text>
  56. </picker>
  57. </view>
  58. </u-form-item>
  59. </u-form>
  60. </view>
  61. <view class="search-btn">
  62. <view class="btn-li" @click="clearValue()">重置</view>
  63. <view class="btn-li" @click="searchConfirm">确定</view>
  64. </view>
  65. </view>
  66. </u-popup>
  67. <view v-if="!outgoing_list.length" class="empty-view"><u-empty text="暂无数据" mode="list"></u-empty></view>
  68. <u-loadmore v-if="outgoing_list.length" :status="load_status" />
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. export default {
  74. data() {
  75. return {
  76. search_show: false,
  77. load_status: 'nomore',
  78. page: 1,
  79. pageSize: 10,
  80. total: 0,
  81. search_form: {
  82. search: '',
  83. startTime: '', // 制单开始时间
  84. endTime: '' // 制单结束时间
  85. },
  86. warehouse_name: '',
  87. outgoing_list: []
  88. };
  89. },
  90. onShow() {
  91. this.getAllStocktaking();
  92. },
  93. onReachBottom() {
  94. if (this.total / this.pageSize > this.page) {
  95. this.page += 1;
  96. this.getData();
  97. }
  98. },
  99. onPullDownRefresh() {
  100. this.searchData();
  101. },
  102. methods: {
  103. details(id) {
  104. uni.navigateTo({
  105. url: '/pagesT/stock/InventoryDetails?id=' + id
  106. });
  107. },
  108. getData() {
  109. const isKey = this.$utils.isSerch(this.search_form);
  110. if (isKey) {
  111. this.searchAllStocktaking();
  112. } else {
  113. this.getAllStocktaking();
  114. }
  115. },
  116. openSel(key) {
  117. this[key] = true;
  118. },
  119. bindDateStartChange(e) {
  120. this.search_form.startTime = this.$utils.timeByTimestamp(e.detail.value + ' 00:00:00');
  121. },
  122. bindDateEndChange(e) {
  123. this.search_form.endTime = this.$utils.timeByTimestamp(e.detail.value + ' 23:59:59');
  124. },
  125. // 重置搜索
  126. clearValue(params) {
  127. if (!params) {
  128. this.search_form = {
  129. startTime: '', // 制单开始时间
  130. endTime: '' // 制单结束时间
  131. };
  132. this.searchConfirm();
  133. } else {
  134. this.search_form[params] = '';
  135. }
  136. },
  137. // 搜索确定
  138. searchConfirm() {
  139. this.search_show = false;
  140. this.searchData();
  141. },
  142. searchData(){
  143. this.page = 1;
  144. this.getData();
  145. },
  146. getAllStocktaking() {
  147. this.load_status = 'loading';
  148. this.$u.api
  149. .getAllStocktaking({
  150. page: this.page,
  151. pageSize: this.pageSize
  152. })
  153. .then(res => {
  154. if (this.page === 1) {
  155. this.outgoing_list = res.data;
  156. } else {
  157. this.outgoing_list = this.outgoing_list.concat(res.data);
  158. }
  159. this.total = res.pageTotal;
  160. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  161. });
  162. },
  163. searchAllStocktaking() {
  164. this.load_status = 'loading';
  165. this.$u.api
  166. .searchAllStocktaking({
  167. page: this.page,
  168. pageSize: this.pageSize,
  169. search: this.search_form.search,
  170. start: this.search_form.startTime,
  171. end: this.search_form.endTime
  172. })
  173. .then(res => {
  174. if (this.page === 1) {
  175. this.outgoing_list = res.data;
  176. } else {
  177. this.outgoing_list = this.outgoing_list.concat(res.data);
  178. }
  179. this.total = res.pageTotal;
  180. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  181. });
  182. }
  183. }
  184. };
  185. </script>
  186. <style lang="scss" scoped>
  187. .tabs-view {
  188. position: fixed;
  189. width: 100%;
  190. top: 0;
  191. left: 0;
  192. z-index: 99;
  193. .keyword-view {
  194. padding: 20rpx 24rpx 0;
  195. background-color: #ffffff;
  196. z-index: 9;
  197. padding-bottom: 20rpx;
  198. .float_left {
  199. width: 640rpx;
  200. }
  201. .float_right {
  202. line-height: 64rpx;
  203. width: 50rpx;
  204. text-align: center;
  205. color: #666666;
  206. }
  207. }
  208. }
  209. .list-ul {
  210. padding-top: 100rpx;
  211. .list-li {
  212. width: 710rpx;
  213. margin: 20rpx auto;
  214. padding: 0 24rpx 20rpx;
  215. background-color: #ffffff;
  216. border-radius: 20rpx;
  217. .title {
  218. line-height: 80rpx;
  219. border-bottom: 1px solid #eeeeee;
  220. .float_left {
  221. font-weight: bold;
  222. }
  223. .float_rigth {
  224. .custom-icon-jinru {
  225. margin-left: 10rpx;
  226. font-size: 28rpx;
  227. }
  228. }
  229. }
  230. .list-cont {
  231. margin-top: 10rpx;
  232. position: relative;
  233. .price {
  234. position: absolute;
  235. top: 50%;
  236. transform: translateY(-50%);
  237. right: 0;
  238. font-weight: bold;
  239. color: $uni-color-error;
  240. .custom-icon-jinru {
  241. font-size: 28rpx;
  242. color: #6c6c6c;
  243. font-weight: 400;
  244. }
  245. }
  246. .list-cont-li {
  247. line-height: 40rpx;
  248. font-size: 24rpx;
  249. color: #666666;
  250. .mobile {
  251. color: $uni-color-primary;
  252. }
  253. }
  254. }
  255. }
  256. }
  257. </style>