Allocation.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <view>
  3. <view class="tabs-view">
  4. <view class="keyword-view clearfix">
  5. <view class="float_left">
  6. <u-search
  7. :show-action="false"
  8. @clear="searchData()"
  9. @search="searchData()"
  10. :clearabled="true"
  11. placeholder="调拨单号/商品名称"
  12. v-model="search_form.no"
  13. ></u-search>
  14. </view>
  15. <view class="float_right" @click="openSel('search_show')"><text class="custom-icon custom-icon-shaixuan"></text></view>
  16. </view>
  17. </view>
  18. <view class="list-ul">
  19. <view class="list-li" @click="details(item.id)" v-for="(item, index) in outgoing_merge_list" :key="index">
  20. <view class="title">
  21. {{ item.warehouseName }}
  22. <view class="icon"><u-icon name="arrow-rightward" color="#B8C0C8"></u-icon></view>
  23. {{ item.inWarehouseName }}
  24. </view>
  25. <view class="list-cont">
  26. <view class="list-cont-li clearfix">
  27. <text class="label">日期:</text>
  28. {{ $u.timeFormat(item.createTime) }}
  29. </view>
  30. <view class="list-cont-li">
  31. <text class="label">单号:</text>
  32. {{ item.no }}
  33. </view>
  34. <view class="list-cont-li">种类{{ item.skuNum }}, 数量{{ item.numT }}</view>
  35. <view class="more-icon">
  36. <text v-if="item.auditStatus === 1" class="warning-status">待审核</text>
  37. <text v-else class="success-status">已审核</text>
  38. <u-icon name="arrow-right" color="#879BBA" size="28"></u-icon>
  39. </view>
  40. </view>
  41. </view>
  42. <addBtn v-if="$accessCheck($Access.AllocationFormAddAllocate)" url="/pagesT/stock/Allocationedit"></addBtn>
  43. <u-popup v-model="search_show" mode="right">
  44. <view class="search-pop">
  45. <view class="form-view">
  46. <u-form label-width="160rpx" label-position="left">
  47. <u-form-item label-position="top" label="制单日期">
  48. <view class="date-li">
  49. <picker mode="date" @change="bindDateStartChange">
  50. <text class="date-li">{{ search_form.startTime ? $u.timeFormat(search_form.startTime, 'yyyy-mm-dd') : '开始日期' }}</text>
  51. </picker>
  52. </view>
  53. <view class="date-line">-</view>
  54. <view class="date-li">
  55. <picker mode="date" @change="bindDateEndChange">
  56. <text class="date-li">{{ search_form.endTime ? $u.timeFormat(search_form.endTime, 'yyyy-mm-dd') : '结束日期' }}</text>
  57. </picker>
  58. </view>
  59. </u-form-item>
  60. <u-form-item label="调出仓库">
  61. <view class="clearfix form-val" @click="goWarehouse(2)">
  62. <text class="float_left ellipsis">{{ search_form.warehouseId ? warehouse_name : '请选择' }}</text>
  63. <view class="float_right" @click.stop="clearValue('warehouseId')">
  64. <u-icon :name="!search_form.warehouseId ? 'arrow-right' : 'close-circle-fill'" size="28" color="#999999"></u-icon>
  65. </view>
  66. </view>
  67. </u-form-item>
  68. <u-form-item label="调入仓库">
  69. <view class="clearfix form-val" @click="goWarehouse(1)">
  70. <text class="float_left ellipsis">{{ search_form.inWarehouseId ? inwarehouse_name : '请选择' }}</text>
  71. <view class="float_right" @click.stop="clearValue('inWarehouseId')">
  72. <u-icon :name="!search_form.inWarehouseId ? 'arrow-right' : 'close-circle-fill'" size="28" color="#999999"></u-icon>
  73. </view>
  74. </view>
  75. </u-form-item>
  76. <u-form-item label="审核状态">
  77. <view class="clearfix form-val" @click="openFrom">
  78. <text class="float_left ellipsis">{{ search_form.auditStatus ? search_form.auditStatusName : '请选择' }}</text>
  79. <view class="float_right" @click.stop="clearValue('auditStatus')">
  80. <u-icon :name="!search_form.auditStatus ? 'arrow-right' : 'close-circle-fill'" size="28" color="#999999"></u-icon>
  81. </view>
  82. </view>
  83. </u-form-item>
  84. </u-form>
  85. </view>
  86. <view class="search-btn">
  87. <view class="btn-li" @click="clearValue()">重置</view>
  88. <view class="btn-li" @click="searchConfirm">确定</view>
  89. </view>
  90. </view>
  91. </u-popup>
  92. <u-select @confirm="fromChange" v-model="from_show" :list="order_status"></u-select>
  93. <view v-if="!outgoing_list.length" class="empty-view"><u-empty text="暂无数据" mode="list"></u-empty></view>
  94. <u-loadmore v-if="outgoing_list.length" :status="load_status" />
  95. </view>
  96. </view>
  97. </template>
  98. <script>
  99. export default {
  100. data() {
  101. return {
  102. search_show: false,
  103. order_status: [
  104. {
  105. value: 2,
  106. label: '已审核'
  107. },
  108. {
  109. value: 1,
  110. label: '待审核'
  111. },
  112. {
  113. value: 3,
  114. label: '审核未通过'
  115. },
  116. {
  117. value: 4,
  118. label: '审核中'
  119. }
  120. ],
  121. load_status: 'nomore',
  122. tabs_current: 0,
  123. page: 1,
  124. pageSize: 10,
  125. total: 0,
  126. source: 5, // 调拨出库 8; 销售出库 5; 采购退货 14;
  127. search_form: {
  128. shopId: '',
  129. shopName: '',
  130. inWarehouseId: '', //调出仓库id
  131. auditStatus: '', //审核状态id
  132. auditStatusName: '', //审核状态名称
  133. goodsName: '', // 商品名称
  134. warehouseId: '', // 仓库id
  135. startTime: '', // 制单开始时间
  136. endTime: '' // 制单结束时间
  137. },
  138. warehouse_name: '',
  139. inwarehouse_name: '',
  140. outgoing_list: [],
  141. outgoing_merge_list: [],
  142. werahouseData: '',
  143. tag: '',
  144. from_show: false
  145. };
  146. },
  147. watch: {
  148. werahouseData(val) {
  149. if (this.tag === 2) {
  150. if (val) {
  151. this.search_form.warehouseId = val.id;
  152. this.warehouse_name = val.warehouseName;
  153. }
  154. } else if (this.tag === 1) {
  155. if (val) {
  156. this.search_form.inWarehouseId = val.id;
  157. this.inwarehouse_name = val.warehouseName;
  158. }
  159. }
  160. }
  161. },
  162. onShow() {
  163. this.getAllAllocate();
  164. },
  165. onReachBottom() {
  166. if (this.total / this.pageSize > this.page) {
  167. this.page += 1;
  168. this.getData();
  169. }
  170. },
  171. onPullDownRefresh() {
  172. this.searchData();
  173. },
  174. methods: {
  175. fromChange(e) {
  176. this.search_form.auditStatus = e[0].value;
  177. this.search_form.auditStatusName = e[0].label;
  178. },
  179. openFrom() {
  180. this.from_show = true;
  181. },
  182. goWarehouse(tag) {
  183. this.tag = tag;
  184. this.goPage('/pagesT/werahouse/selWerahouse');
  185. },
  186. details(id) {
  187. uni.navigateTo({
  188. url: '/pagesT/stock/AllocationDetails?id=' + id
  189. });
  190. },
  191. openSel(key) {
  192. this[key] = true;
  193. },
  194. bindDateStartChange(e) {
  195. this.search_form.startTime = this.$utils.timeByTimestamp(e.detail.value + ' 00:00:00');
  196. },
  197. bindDateEndChange(e) {
  198. this.search_form.endTime = this.$utils.timeByTimestamp(e.detail.value + ' 23:59:59');
  199. },
  200. // 搜索确定
  201. searchConfirm() {
  202. this.search_show = false;
  203. this.searchData();
  204. },
  205. // 重置搜索
  206. clearValue(params) {
  207. if (!params) {
  208. this.search_form = {
  209. no: '',
  210. shopId: '',
  211. shopName: '',
  212. inWarehouseId: '', //调出仓库id
  213. auditStatus: '', //审核状态id
  214. auditStatusName: '', //审核状态名称
  215. goodsName: '', // 商品名称
  216. warehouseId: '', // 仓库id
  217. startTime: '', // 制单开始时间
  218. endTime: '' // 制单结束时间
  219. };
  220. this.searchConfirm();
  221. } else {
  222. this.search_form[params] = '';
  223. }
  224. },
  225. getAllAllocate() {
  226. this.load_status = 'loading';
  227. this.$u.api
  228. .getAllAllocate({
  229. page: this.page,
  230. pageSize: this.pageSize
  231. })
  232. .then(res => {
  233. if (this.page === 1) {
  234. this.outgoing_list = res.data;
  235. } else {
  236. this.outgoing_list = this.outgoing_list.concat(res.data);
  237. }
  238. let arr = [];
  239. this.outgoing_list.forEach(item => {
  240. const index = arr.findIndex(ia => ia.id === item.id);
  241. if (index === -1) {
  242. arr.push({
  243. ...item,
  244. skuNum: 1,
  245. numT: Number(item.num)
  246. });
  247. } else {
  248. arr[index].skuNum += 1;
  249. arr[index].numT = this.$NP.plus(arr[index].numT, Number(item.num));
  250. }
  251. });
  252. this.outgoing_merge_list = arr;
  253. this.total = res.pageTotal;
  254. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  255. });
  256. },
  257. searchAllocate() {
  258. this.load_status = 'loading';
  259. this.$u.api
  260. .searchAllocate({
  261. page: this.page,
  262. pageSize: this.pageSize,
  263. search: this.search_form.no,
  264. star: this.search_form.startTime,
  265. end: this.search_form.endTime,
  266. inWarehouseId: this.search_form.inWarehouseId,
  267. auditStatus: this.search_form.auditStatus,
  268. warehouseId: this.search_form.warehouseId
  269. })
  270. .then(res => {
  271. if (this.page === 1) {
  272. this.outgoing_list = res.data;
  273. } else {
  274. this.outgoing_list = this.outgoing_list.concat(res.data);
  275. }
  276. let arr = [];
  277. this.outgoing_list.forEach(item => {
  278. const index = arr.findIndex(ia => ia.id === item.id);
  279. if (index === -1) {
  280. arr.push({
  281. ...item,
  282. skuNum: 1,
  283. numT: Number(item.num)
  284. });
  285. } else {
  286. arr[index].skuNum += 1;
  287. arr[index].numT = this.$NP.plus(arr[index].numT, Number(item.num));
  288. }
  289. });
  290. this.outgoing_merge_list = arr;
  291. this.total = res.pageTotal;
  292. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  293. });
  294. },
  295. // 判断
  296. getData() {
  297. const isKey = this.$utils.isSerch(this.search_form);
  298. if (isKey) {
  299. this.searchAllocate();
  300. } else {
  301. this.getAllAllocate();
  302. }
  303. },
  304. searchData() {
  305. this.page = 1;
  306. this.getData();
  307. }
  308. }
  309. };
  310. </script>
  311. <style lang="scss" scoped>
  312. .tabs-view {
  313. position: fixed;
  314. width: 100%;
  315. top: 0;
  316. left: 0;
  317. z-index: 99;
  318. .keyword-view {
  319. padding: 20rpx 24rpx 0;
  320. background-color: #ffffff;
  321. z-index: 9;
  322. padding-bottom: 20rpx;
  323. .float_left {
  324. width: 640rpx;
  325. }
  326. .float_right {
  327. line-height: 64rpx;
  328. width: 50rpx;
  329. text-align: center;
  330. color: #666666;
  331. }
  332. }
  333. }
  334. .list-ul {
  335. padding-top: 100rpx;
  336. .list-li {
  337. width: 710rpx;
  338. margin: 20rpx auto;
  339. padding: 0 24rpx 20rpx;
  340. background-color: #ffffff;
  341. border-radius: 20rpx;
  342. .title {
  343. line-height: 80rpx;
  344. border-bottom: 1px solid #eeeeee;
  345. font-size: 26rpx;
  346. .icon {
  347. display: inline-block;
  348. margin: 0 10rpx;
  349. }
  350. }
  351. .list-cont {
  352. padding-top: 20rpx;
  353. font-size: 24rpx;
  354. line-height: 40rpx;
  355. color: #62738e;
  356. position: relative;
  357. .more-icon {
  358. position: absolute;
  359. top: 50%;
  360. transform: translateY(-50%);
  361. right: 20rpx;
  362. }
  363. }
  364. }
  365. }
  366. </style>