SaleOutDetail.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. <template>
  2. <view class="detail-view">
  3. <view class="top-view clearfix">
  4. <view class="float_left">
  5. <text v-if="bill_detail.auditStatus === 2" class="status-text">已审核</text>
  6. <text v-else class="status-text">未审核</text>
  7. </view>
  8. </view>
  9. <view class="detail-cont">
  10. <view class="info-li clearfix">
  11. <view class="label">单据编号</view>
  12. <view class="value" @click="copy(bill_detail.no)">
  13. <u-icon margin-right="20" label-pos="left" :label="bill_detail.no || ''" name="copy" custom-prefix="custom-icon" size="24"></u-icon>
  14. </view>
  15. </view>
  16. <view class="info-li clearfix">
  17. <view class="label">出库类型</view>
  18. <view class="value">{{ bill_detail.typeName || '' }}</view>
  19. </view>
  20. <view class="info-li clearfix" v-if="bill_detail.typeName !== '调拨出库'">
  21. <view class="label">客户</view>
  22. <view class="value">{{ bill_detail.customerName || '' }}</view>
  23. </view>
  24. <view class="info-li clearfix" v-else>
  25. <view class="label">调出仓库</view>
  26. <view class="value">{{ out_warehouse_data[0].warehouseName }}</view>
  27. </view>
  28. <view class="info-li clearfix">
  29. <view class="label">制单人</view>
  30. <view class="value">{{ bill_detail.operatorName || '' }}</view>
  31. </view>
  32. <view class="info-li clearfix">
  33. <view class="label">制单时间</view>
  34. <view class="value">{{ $u.timeFormat(bill_detail.createTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
  35. </view>
  36. <view class="info-li clearfix" v-if="bill_detail.auditStatus === 2">
  37. <view class="label">审核人</view>
  38. <view class="value">{{ bill_detail.auditName || '' }}</view>
  39. </view>
  40. <view class="info-li clearfix" v-if="bill_detail.auditStatus === 2">
  41. <view class="label">入库时间</view>
  42. <view class="value">{{ $u.timeFormat(bill_detail.auditTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
  43. </view>
  44. <!-- 未分配仓库 -->
  45. <view class="goods-view-box" v-if="unassigned_sku_data.length">
  46. <view class="goods-title">未分配仓库</view>
  47. <view class="goods-ul">
  48. <view class="goods-li clearfix" v-for="(item, index) in unassigned_sku_data" :key="index">
  49. <view class="info">
  50. <block v-if="item.warehouseSelect&&item.warehouseSelect.length">
  51. <view v-if="bill_detail.isDistribution === 5" class="goods-warehouse clearfix" @click="openUnWarahouse(item, index)">
  52. <view class="float_left ellipsis">{{ item.warehouseName || '请选择仓库' }}</view>
  53. <view class="float_right"><u-icon name="arrow-down" size="28"></u-icon></view>
  54. </view>
  55. </block>
  56. <block v-else>
  57. <view class="goods-warehouse clearfix">
  58. <view class="float_left" style="color: #808080;">无可用仓库</view>
  59. </view>
  60. </block>
  61. <view class="goods-name">
  62. <view class="float_left ellipsis">{{ item.materielName }}</view>
  63. <view class="float_right">{{ item.materielCode }}</view>
  64. </view>
  65. <view class="goods-num clearfix">
  66. <view class="float_left">{{ item.unitName }};{{ item.skuName }}</view>
  67. <view class="float_right">
  68. <text>{{ $utils.formatNub(item.num) }}x{{ $utils.formatNub(item.unitPrice) }}=</text>
  69. <text>¥{{ $NP.times(Number(item.unitPrice), Number(item.num)) }}</text>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. <!-- 仓库出库数据-->
  77. <block v-for="(ware, iw) in out_warehouse_data" :key="iw">
  78. <view class="goods-view-box" v-if="ware.details.length">
  79. <view class="goods-title">{{ ware.warehouseName }}</view>
  80. <view class="goods-ul">
  81. <view class="goods-li clearfix" v-for="(item, index) in ware.details" :key="index">
  82. <view class="info">
  83. <view v-if="bill_detail.isDistribution === 5" class="goods-warehouse clearfix" @click="openWarahouse(iw, index, item)">
  84. <view class="float_left ellipsis">{{ item.warehouseName }}</view>
  85. <view class="float_right"><u-icon name="arrow-down" size="28"></u-icon></view>
  86. </view>
  87. <view v-else class="goods-warehouse clearfix">
  88. <view class="float_left ellipsis">{{ item.warehouseName }}</view>
  89. </view>
  90. <view class="goods-name">
  91. <view class="float_left ellipsis">{{ item.materielName }}</view>
  92. <view class="float_right">{{ item.materielCode }}</view>
  93. </view>
  94. <view class="goods-num clearfix">
  95. <view class="float_left">{{ item.unitName }};{{ item.skuName }}</view>
  96. <view class="float_right">
  97. <text>x{{ $utils.formatNub(item.total) }}</text>
  98. <text v-if="!!item.extend && item.extend !== 'null'">({{ item.extend.u_1_buy }}{{ item.extend.u_1 }})</text>
  99. </view>
  100. </view>
  101. <view class="num-ul">
  102. <view class="num-li">
  103. <view class="label">出库量</view>
  104. <view class="value">
  105. <text v-if="bill_detail.auditStatus === 2">{{ $utils.formatNub(item.outNum) }}</text>
  106. <input v-else @blur="saleNumBlur(item.num, index, iw, item)" type="digit" v-model="item.num" />
  107. </view>
  108. </view>
  109. <view class="num-li" v-if="!!item.extend && item.extend !== 'null'">
  110. <view class="label">其他单位</view>
  111. <view class="value">
  112. <text v-if="bill_detail.auditStatus === 2">{{ $utils.formatNub(item.otherNum) }}</text>
  113. <input v-else type="digit" v-model="item.otherNum" />
  114. </view>
  115. </view>
  116. <view v-if="enableLocationManagement === 5" class="num-li">
  117. <view class="label">库位</view>
  118. <view class="value">
  119. <input
  120. @click="selLocation(iw, index, ware.warehouseId, item)"
  121. disabled
  122. :placeholder="bill_detail.auditStatus === 2 ? '未设置' : '请选择'"
  123. placeholder-class="input-pl"
  124. v-model="item.storageLocationName"
  125. />
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. </block>
  134. <!-- 商品清单 -->
  135. <view class="goods-view-box">
  136. <view class="goods-title">商品清单</view>
  137. <view class="goods-ul">
  138. <view class="goods-li clearfix" v-for="(item, index) in bill_detail.details" :key="index">
  139. <view class="goods-img float_left">
  140. <image :src="item.images && item.images.length ? item.images[0] : '../../static/img/goods.png'" mode="aspectFill"></image>
  141. </view>
  142. <view class="float_left info list-info">
  143. <view class="goods-name ellipsis">{{ item.materielName }}</view>
  144. <view class="goods-code">{{ item.materielCode }}</view>
  145. <view class="goods-num clearfix">
  146. <view class="float_left">{{ item.unitName }};{{ item.skuName }}</view>
  147. <view class="float_right">
  148. <text v-if="bill_detail.auditStatus === 2">x{{ $utils.formatNub(item.outNum) }}</text>
  149. <text v-else>x{{ $utils.formatNub(item.num) }}</text>
  150. <text v-if="item.isEq === 5">({{ $utils.formatNub(item.u_1_buy) }}{{ item.u_1 }})</text>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. </view>
  156. </view>
  157. <view class="remark-li">
  158. <view class="label">备注</view>
  159. <view class="remark">
  160. <text>{{ bill_detail.remark || '无' }}</text>
  161. </view>
  162. </view>
  163. </view>
  164. <view v-if="bill_detail.auditStatus === 2 && bill_detail.deliveryType === 3" class="detail-bottom">
  165. <view class="handel-btn" @click="goPage(`/pagesT/stock/setLogistics?sourceId=${bill_detail.sourceId}&&type=${bill_detail.type}&&outId=${bill_detail.id}`)">设置物流信息</view>
  166. </view>
  167. <view v-if="$accessCheck($Access.InventoryOutUpdateInventoryOutStatus) && bill_detail.auditStatus !== 2" class="detail-bottom">
  168. <view class="handel-btn" @click="openModel('确定要审核该出库单吗?', '审核')">审核</view>
  169. </view>
  170. <u-modal v-model="model_show" :show-cancel-button="true" :content="model_content" @confirm="modelConfirm" @cancel="modelCancel"></u-modal>
  171. <u-select value-name="warehouseId" label-name="warehouseName" @confirm="warehouseConfirm" v-model="warehouse_show" :list="warehouse_list"></u-select>
  172. </view>
  173. </template>
  174. <script>
  175. export default {
  176. data() {
  177. return {
  178. warahouse_tag: 5, // 仓库选择类型 4 未选择仓库,5 已分配仓库
  179. un_warehouse_obj: {},
  180. warehouse_obj: {},
  181. warehouse_show: false, //选择仓库
  182. warehouse_list: [],
  183. model_tag: '',
  184. model_show: false,
  185. model_content: '',
  186. bill_id: 0,
  187. bill_detail: {},
  188. goods_index: 0,
  189. out_index: 0,
  190. out_warehouse_copy: [],
  191. out_warehouse_data: [], // 商品清单,按仓库分
  192. unassigned_sku_data: [], // 未出库商品
  193. sku_total: {},
  194. areaBysku: ''
  195. };
  196. },
  197. onPullDownRefresh() {
  198. this.getInventoryOutInfo();
  199. },
  200. computed: {
  201. userInfo() {
  202. return this.$store.state.userInfo;
  203. },
  204. enableLocationManagement() {
  205. return parseInt(this.$store.state.basicSet.enableLocationManagement);
  206. }
  207. },
  208. watch: {
  209. areaBysku(val) {
  210. if (val) {
  211. const target = this.$u.deepClone(this.out_warehouse_data);
  212. target[this.out_index].details[this.goods_index] = {
  213. ...target[this.out_index].details[this.goods_index],
  214. areaId: val.areaId,
  215. areaName: val.areaName,
  216. areaCode: val.areaCode,
  217. storageLocationId: val.storageLocationId,
  218. storageLocationName: val.storageLocationName,
  219. storageLocationCode: val.storageLocationCode
  220. };
  221. this.out_warehouse_data = target;
  222. }
  223. }
  224. },
  225. onLoad(options) {
  226. this.bill_id = options.id;
  227. this.getInventoryOutInfo();
  228. },
  229. // onShow() {
  230. // this.bill_id = options.id;
  231. // this.getInventoryOutInfo();
  232. // },
  233. methods: {
  234. // 去选择库区库位页面
  235. selLocation(iw, index, warehouseId, row) {
  236. if (this.bill_detail.auditStatus === 2) {
  237. return;
  238. }
  239. this.out_index = iw;
  240. this.goods_index = index;
  241. this.goPage(`/pagesT/stock/WarehouseRegionBySku?basicGoodsId=${row.materielId}&skuId=${row.skuId}&warehouseId=${warehouseId}`);
  242. },
  243. // 详情
  244. getInventoryOutInfo() {
  245. this.$u.api
  246. .getInventoryOutInfo(this.bill_id)
  247. .then(res => {
  248. uni.stopPullDownRefresh();
  249. const data = res.data;
  250. this.bill_detail = data;
  251. this.out_warehouse_copy = this.$u.deepClone(data.outWarehouseData);
  252. // 存一下未修改的原始出库数量
  253. data.outWarehouseData.forEach(item => {
  254. item.details.forEach(goods => {
  255. goods.numCopy = Number(goods.num);
  256. // 抄嘛商品默认为空
  257. if (goods.extend !== 'null' && !!goods.extend) {
  258. goods.extend = JSON.parse(goods.extend);
  259. if (!Number(goods.otherNum)) {
  260. goods.otherNum = this.$NP.divide(goods.numCopy, goods.extend.conversion);
  261. }
  262. goods.num = '';
  263. } else {
  264. goods.num = Number(goods.num);
  265. }
  266. });
  267. });
  268. // 商品清单,按仓库分
  269. this.out_warehouse_data = data.outWarehouseData;
  270. // 未出库商品
  271. this.unassigned_sku_data = data.UnassignedSkuData;
  272. this.sku_total = data.skuTotal;
  273. })
  274. .catch(err => {
  275. uni.stopPullDownRefresh();
  276. });
  277. },
  278. // 打开仓库选择器
  279. openWarahouse(index, rowI, row) {
  280. this.warahouse_tag = 5;
  281. this.warehouse_list = row.warehouseSelect;
  282. this.warehouse_show = true;
  283. this.warehouse_obj = {
  284. index: index,
  285. rowI: rowI,
  286. row: row
  287. };
  288. },
  289. warehouseConfirm(arr) {
  290. if (this.warahouse_tag === 5) {
  291. this.warehouseChange(arr[0], this.warehouse_obj);
  292. } else {
  293. this.unWarehouseChange(arr[0], this.un_warehouse_obj);
  294. }
  295. this.warehouse_show = false;
  296. },
  297. // 获取当前合计销售量
  298. totalNumChange(target, row) {
  299. // 设置变量num
  300. let num = 0;
  301. target.forEach(item => {
  302. const goods = item.details.find(item => item.skuId === row.skuId);
  303. if (goods) {
  304. // 加上当前商品销售量
  305. num = this.$NP.plus(num, goods.num);
  306. }
  307. });
  308. return num;
  309. },
  310. // 切换仓库
  311. warehouseChange(obj, { index, rowI, row }) {
  312. const val = obj.value;
  313. // 深拷贝一份商品数据
  314. const target = this.$u.deepClone(this.out_warehouse_data);
  315. // 在要出库的列表中查找当前切换的仓库是否存在
  316. const wIndex = target.findIndex(item => item.warehouseId === val);
  317. if (wIndex > -1) {
  318. // 当前仓库存在
  319. // 查找商品是否存在
  320. const gIndex = target[wIndex].details.findIndex(item => item.skuId === row.skuId);
  321. if (gIndex > -1) {
  322. // 商品存在
  323. // 累加销售量
  324. target[wIndex].details[gIndex].num = this.$NP.plus(target[wIndex].details[gIndex].num, row.num);
  325. } else {
  326. // 商品不存在,添加该商品
  327. target[wIndex].details.push({
  328. ...row,
  329. warehouseId: val,
  330. warehouseName: obj.label
  331. });
  332. }
  333. } else {
  334. // 仓库不存在,添加一项仓库数据
  335. const warehouseName = row.warehouseSelect.find(item => item.warehouseId === val).warehouseName;
  336. target.push({
  337. warehouseId: val,
  338. warehouseName: warehouseName,
  339. details: [
  340. {
  341. ...row,
  342. warehouseId: val,
  343. warehouseName: warehouseName
  344. }
  345. ]
  346. });
  347. }
  348. // 把当前这条商品从原来的位置删除
  349. target[index].details.splice(rowI, 1);
  350. // 未开启负库存
  351. if (row.isPreSale === 4) {
  352. // 查找当前切换仓库数据
  353. const warehouseData = row.warehouseSelect.find(item => item.warehouseId === val);
  354. // 查找当前仓库在出库列表的数据
  355. const targetI = target.findIndex(item => item.warehouseId === val);
  356. // 查找当前商品在该仓库下出库列表的数据
  357. const goodsI = target[targetI].details.findIndex(item => item.skuId === row.skuId);
  358. // 如果当前数量大于该仓库下的库存,推入到未出库数据中
  359. if (target[targetI].details[goodsI].num > warehouseData.warehouseInventoryNum) {
  360. // 拷贝一份未出库数据
  361. const unassignedData = this.$u.deepClone(this.unassigned_sku_data);
  362. // 判断当前未出库数据中是否有当前规格的商品
  363. const unIndex = unassignedData.findIndex(unItem => unItem.skuId === row.skuId);
  364. // 设置当前未出库商品
  365. const goods = {
  366. ...target[targetI].details[goodsI],
  367. num: this.$NP.minus(target[targetI].details[goodsI].num, warehouseData.warehouseInventoryNum),
  368. warehouseId: ''
  369. };
  370. // 未出库商品列表有该商品,则替换
  371. if (unIndex > -1) {
  372. unassignedData[unIndex] = goods;
  373. } else {
  374. // 没有该商品则推入
  375. unassignedData.push(goods);
  376. }
  377. // 给未出库商品列表重新赋值
  378. this.unassigned_sku_data = unassignedData;
  379. // 设置当前商品销售量为该仓库的最大库存
  380. target[targetI].details[goodsI].num = warehouseData.warehouseInventoryNum;
  381. }
  382. }
  383. // 给出库数据重新赋值
  384. this.out_warehouse_data = target;
  385. },
  386. // 销售量修改
  387. saleNumBlur(val, rowI, index, row) {
  388. // 深拷贝一份商品数据
  389. const target = this.$u.deepClone(this.out_warehouse_data);
  390. /*if (val <= 0) {
  391. this.$nextTick(() => {
  392. target[index].details[rowI].num = '';
  393. });
  394. this.out_warehouse_data = target;
  395. return;
  396. }*/
  397. if (target[index].details[rowI].num > Number(this.sku_total[target[index].details[rowI].skuId])) {
  398. target[index].details[rowI].num = Number(this.sku_total[target[index].details[rowI].skuId]);
  399. this.out_warehouse_data = target;
  400. return;
  401. }
  402. // 不支持负库存
  403. if (row.isPreSale === 4) {
  404. const warehouseData = row.warehouseSelect.find(item => item.warehouseId === row.warehouseId);
  405. // 输入值大于当前仓库库存数
  406. if (Number(val) > Number(warehouseData.warehouseInventoryNum)) {
  407. // 把当前商品的销售量还原
  408. target[index].details[rowI].num = target[index].details[rowI].numCopy;
  409. }
  410. }
  411. // 深拷贝一份未出库商品数据
  412. const unassignedData = this.$u.deepClone(this.unassigned_sku_data);
  413. // 判断当前未出库数据中是否有当前规格的商品
  414. const unIndex = unassignedData.findIndex(unItem => unItem.skuId === row.skuId);
  415. // 设置变量num 获取当前合计销售量
  416. let num = this.totalNumChange(target, row);
  417. // 判断当前修改后的合计商品销售量是否大于购买数量,大于就把当前商品的销售量还原
  418. if (num > this.sku_total[row.skuId]) {
  419. // 修改后的合计商品销售量大于购买数量,把当前商品的销售量设置为空
  420. target[index].details[rowI].num = '';
  421. } else if (num === Number(this.sku_total[row.skuId])) {
  422. // 修改后的合计商品销售量等于购买数量
  423. // 未出库商品列表有该商品,则删除
  424. if (unIndex > -1) {
  425. unassignedData.splice(unIndex, 1);
  426. }
  427. } else if (this.$NP.minus(this.sku_total[row.skuId] || 0, num) > 0) {
  428. // 当前未出库库存大于0
  429. // 设置当前未出库商品
  430. const numin = this.$NP.minus(this.sku_total[row.skuId], num);
  431. const goods = {
  432. ...this.$u.deepClone(target[index].details[rowI]),
  433. num: numin,
  434. numCopy: numin,
  435. warehouseId: '',
  436. warehouseName: ''
  437. };
  438. // 未出库商品列表有该商品,则替换
  439. if (unIndex > -1) {
  440. unassignedData[unIndex] = goods;
  441. } else {
  442. // 没有该商品则推入
  443. unassignedData.push(goods);
  444. // 如果输入数量为0 ,则把对应出库商品清除
  445. if (num === 0) {
  446. target[index].details.splice(rowI, 1);
  447. }
  448. }
  449. }
  450. // 给未出库商品列表重新赋值
  451. this.unassigned_sku_data = unassignedData;
  452. // 给出库商品列表重新赋值
  453. this.out_warehouse_data = target;
  454. },
  455. //未出库数据仓库 打开弹窗
  456. openUnWarahouse(row, indexUn) {
  457. this.warahouse_tag = 4;
  458. this.warehouse_list = row.warehouseSelect;
  459. this.warehouse_show = true;
  460. this.un_warehouse_obj = {
  461. indexUn: indexUn,
  462. row: row
  463. };
  464. },
  465. // 未出库数据仓库选择
  466. unWarehouseChange(arr, { row, indexUn }) {
  467. const val = arr.value;
  468. // 深拷贝一份商品数据
  469. const target = this.$u.deepClone(this.out_warehouse_data);
  470. // 在出库商品数据中查找选择仓库
  471. const index = target.findIndex(item => item.warehouseId === val);
  472. // 出库商品数据中有该选择的仓库
  473. if (index > -1) {
  474. // 找到商品所在下标(位置)
  475. const goodsI = target[index].details.findIndex(goods => goods.skuId === row.skuId);
  476. // 该仓库下包含当前商品
  477. if (goodsI > -1) {
  478. target[index].details[goodsI].num = this.$NP.plus(target[index].details[goodsI].num, row.num);
  479. } else {
  480. // 该仓库下不包含当前商品,把当前商品推到该仓库下面
  481. target[index].details.push({
  482. ...row,
  483. warehouseId: val,
  484. warehouseName: arr.label
  485. });
  486. }
  487. } else {
  488. // 出库商品数据中没有该选择的仓库,添加一项仓库数据
  489. const warehouseName = row.warehouseSelect.find(item => item.warehouseId === val).warehouseName;
  490. target.push({
  491. warehouseId: val,
  492. warehouseName: warehouseName,
  493. details: [
  494. {
  495. ...row,
  496. warehouseId: val,
  497. warehouseName: warehouseName
  498. }
  499. ]
  500. });
  501. }
  502. // 把当前这条商品从原来的位置删除
  503. this.unassigned_sku_data.splice(indexUn, 1);
  504. this.out_warehouse_data = target;
  505. },
  506. // 打开提示框
  507. openModel(content, tag) {
  508. this.model_content = content;
  509. this.model_show = true;
  510. this.model_tag = tag;
  511. },
  512. // 审核
  513. modelConfirm() {
  514. switch (this.model_tag) {
  515. case '审核':
  516. this.updateSaleOutStatus();
  517. break;
  518. }
  519. },
  520. modelCancel() {},
  521. // 审核订单
  522. async updateSaleOutStatus() {
  523. let flag = false;
  524. for (let i in this.out_warehouse_data) {
  525. for (let j in this.out_warehouse_data[i].details) {
  526. let item1 = this.out_warehouse_data[i].details[j];
  527. if (!item1.num) {
  528. flag = true;
  529. this.$u.toast('商品' + item1.materielName + ',规格 【' + item1.unitName + ';' + item1.skuName + '】的出库数量不能为空');
  530. break;
  531. }
  532. if (item1.otherNum < 0) {
  533. flag = true;
  534. this.$u.toast('商品' + item1.materielName + ',规格 【' + item1.unitName + ';' + item1.skuName + '】的其他数量不能小于0');
  535. break;
  536. }
  537. }
  538. }
  539. if (flag) {
  540. return;
  541. }
  542. if (!this.out_warehouse_data || !this.out_warehouse_data.length) {
  543. this.$u.toast({
  544. type: 'warning',
  545. message: '请选择出库商品'
  546. });
  547. return;
  548. }
  549. let isNum = true;
  550. // 过滤 出去没有商品的
  551. const outWarehouseData = this.out_warehouse_data.filter(item => item.details && item.details.length > 0);
  552. if (!outWarehouseData.length) {
  553. this.$message.warning('请选择要出库的商品');
  554. return;
  555. }
  556. for (let i in outWarehouseData) {
  557. let item = this.out_warehouse_data[i];
  558. for (let n in item.details) {
  559. let ntem = item.details[n];
  560. if (ntem.num <= 0) {
  561. isNum = false;
  562. break;
  563. }
  564. }
  565. }
  566. if (!isNum) {
  567. this.$u.toast('销售量必须大于0');
  568. return;
  569. }
  570. this.loading = true;
  571. this.$u.api
  572. .updateSaleOutStatus({
  573. id: this.bill_id,
  574. auditName: this.userInfo.name,
  575. UnassignedSkuData: this.unassigned_sku_data,
  576. outWarehouseData: outWarehouseData
  577. })
  578. .then(res => {
  579. this.loading = false;
  580. this.$u.toast('操作成功!');
  581. // 审核成功填写货车信息
  582. if (this.bill_detail.deliveryType === 3) {
  583. // this.logistics_show = true;
  584. }
  585. this.getInventoryOutInfo();
  586. })
  587. .catch(err => {
  588. this.loading = false;
  589. });
  590. }
  591. }
  592. };
  593. </script>
  594. <style lang="scss" scoped>
  595. .detail-view {
  596. padding-bottom: 100rpx;
  597. }
  598. .top-view {
  599. background-color: $uni-color-primary;
  600. height: 200rpx;
  601. padding: 0 30rpx;
  602. color: #ffffff;
  603. font-size: 40rpx;
  604. line-height: 100rpx;
  605. .status-text {
  606. margin-right: 10rpx;
  607. }
  608. .float_right {
  609. font-size: 28rpx;
  610. }
  611. }
  612. .detail-cont {
  613. width: 710rpx;
  614. margin: 0 auto;
  615. background-color: #ffffff;
  616. border-radius: 20rpx;
  617. padding: 20rpx 0;
  618. overflow: hidden;
  619. transform: translateY(-80rpx);
  620. .info-li {
  621. padding: 0 30rpx;
  622. line-height: 80rpx;
  623. .label {
  624. float: left;
  625. color: #6c6c6c;
  626. }
  627. .value {
  628. float: right;
  629. }
  630. .money-label {
  631. font-weight: bold;
  632. }
  633. .money-value {
  634. font-weight: bold;
  635. font-size: 30rpx;
  636. }
  637. }
  638. .remark-li {
  639. padding: 0 30rpx;
  640. .label {
  641. color: #6c6c6c;
  642. line-height: 60rpx;
  643. }
  644. }
  645. .b-b {
  646. border-bottom: 1px solid #eeeeee;
  647. }
  648. .goods-title {
  649. background-color: #5e6a84;
  650. line-height: 72rpx;
  651. width: 644rpx;
  652. margin: 30rpx auto 0;
  653. color: #ffffff;
  654. border-top-left-radius: 20rpx;
  655. border-top-right-radius: 20rpx;
  656. padding: 0 24rpx;
  657. position: relative;
  658. z-index: 1;
  659. }
  660. .goods-ul {
  661. padding: 0 30rpx 30rpx;
  662. box-shadow: 0px -3px 12rpx 0px #e4eaf5;
  663. border-bottom: 1px solid #eeeeee;
  664. .goods-li {
  665. padding-top: 24rpx;
  666. .goods-img {
  667. margin-right: 20rpx;
  668. image {
  669. width: 150rpx;
  670. height: 150rpx;
  671. border-radius: 8rpx;
  672. display: block;
  673. background-color: #f5f5f5;
  674. }
  675. }
  676. .num-ul {
  677. display: flex;
  678. font-size: 24rpx;
  679. padding-top: 10rpx;
  680. .num-li {
  681. flex: 4;
  682. border-right: 1px solid #ecf0f7;
  683. text-align: center;
  684. padding: 0 10rpx;
  685. &:last-child {
  686. border-right: 0 none;
  687. }
  688. .label {
  689. color: #879bba;
  690. }
  691. .value {
  692. height: 40rpx;
  693. line-height: 40rpx;
  694. border-bottom: 1px solid $uni-color-primary;
  695. input {
  696. font-size: 24rpx;
  697. height: 40rpx;
  698. line-height: 40rpx;
  699. }
  700. }
  701. }
  702. }
  703. .info {
  704. .goods-name {
  705. height: 34rpx;
  706. line-height: 34rpx;
  707. .float_left {
  708. width: 420rpx;
  709. }
  710. .float_right {
  711. font-size: 22rpx;
  712. }
  713. }
  714. .goods-warehouse {
  715. padding-bottom: 10rpx;
  716. .float_left {
  717. width: 590rpx;
  718. }
  719. }
  720. .goods-code {
  721. font-size: 24rpx;
  722. padding-top: 10rpx;
  723. }
  724. .goods-num {
  725. padding-top: 10rpx;
  726. font-size: 24rpx;
  727. .price {
  728. font-size: 28rpx;
  729. font-weight: bold;
  730. color: $uni-color-error;
  731. }
  732. input {
  733. vertical-align: middle;
  734. display: inline-block;
  735. width: 150rpx;
  736. line-height: 60rpx;
  737. border: 1px solid #eeeeee;
  738. border-radius: 10rpx;
  739. padding: 0 10rpx;
  740. }
  741. }
  742. }
  743. .list-info {
  744. width: 470rpx;
  745. }
  746. }
  747. }
  748. }
  749. </style>