GodownEntryDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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">
  21. <view class="label">仓库</view>
  22. <view class="value">{{ bill_detail.warehouseName }}</view>
  23. </view>
  24. <view class="info-li clearfix">
  25. <view class="label">制单人</view>
  26. <view class="value">{{ bill_detail.operatorName }}</view>
  27. </view>
  28. <view class="info-li clearfix">
  29. <view class="label">制单时间</view>
  30. <view class="value">{{ $u.timeFormat(bill_detail.createTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
  31. </view>
  32. <view class="info-li clearfix" v-if="bill_detail.auditStatus === 2">
  33. <view class="label">审核人</view>
  34. <view class="value">{{ bill_detail.auditName }}</view>
  35. </view>
  36. <view class="info-li clearfix" v-if="bill_detail.auditStatus === 2">
  37. <view class="label">入库时间</view>
  38. <view class="value">{{ $u.timeFormat(bill_detail.auditTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
  39. </view>
  40. <view class="goods-title">商品清单</view>
  41. <view class="goods-ul">
  42. <view class="goods-li" v-for="(item, index) in bill_detail.details" :key="index">
  43. <view class="clearfix">
  44. <view class="goods-img float_left">
  45. <image :src="item.images && item.images.length ? item.images[0] : '../../static/img/goods.png'" mode="aspectFill"></image>
  46. </view>
  47. <view class="float_left info">
  48. <view class="goods-name ellipsis">{{ item.materielName }}</view>
  49. <view class="goods-code">{{ item.materielCode }}</view>
  50. <view class="goods-num clearfix">
  51. <view class="float_left">{{ item.unitName }};{{ item.skuName }}</view>
  52. <text class="float_right">x{{ $utils.formatNub(item.num) }}{{ item.unitName }}</text>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="num-ul">
  57. <view class="num-li">
  58. <view class="label">入库</view>
  59. <view class="value">
  60. <input v-if="bill_detail.auditStatus === 1" type="digit" v-model="item.inNum" />
  61. <text v-else>{{ $utils.formatNub(item.inNum) }}</text>
  62. </view>
  63. </view>
  64. <view v-if="item.isEq === 5" class="num-li">
  65. <view class="label">其他单位</view>
  66. <view class="value">
  67. <input v-if="bill_detail.auditStatus === 1" type="digit" v-model="item.otherNum" />
  68. <text v-else>{{ $utils.formatNub(item.otherNum) }}</text>
  69. </view>
  70. </view>
  71. <view v-if="shelfLifeSetUp === 5" class="num-li">
  72. <view class="label">生产日期</view>
  73. <view class="value"><input disabled @click="openTime(index)" :value="$u.timeFormat(item.productionData)" /></view>
  74. </view>
  75. <view v-if="enableLocationManagement === 5" class="num-li">
  76. <view class="label">库位</view>
  77. <view class="value">
  78. <input
  79. @click="selLocation(index)"
  80. disabled
  81. :placeholder="bill_detail.auditStatus === 2 ? '未设置' : '请选择'"
  82. placeholder-class="input-pl"
  83. v-model="item.storageLocationName"
  84. />
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. <view class="remark-li">
  91. <view class="label">备注</view>
  92. <view class="remark">
  93. <u-input v-if="bill_detail.auditStatus === 1" v-model="bill_detail.remark" type="textarea" border />
  94. <text v-else>{{ bill_detail.remark || '无' }}</text>
  95. </view>
  96. </view>
  97. </view>
  98. <u-picker v-model="time_show" @confirm="timeConfirm" mode="time"></u-picker>
  99. <view v-if="$accessCheck($Access.InventoryInUpdateInventoryInStatus) && bill_detail.auditStatus !== 2" class="detail-bottom">
  100. <view class="handel-btn" @click="openModel('确定要审核通过该订单吗?', '审核')">审核</view>
  101. </view>
  102. <u-modal v-model="model_show" :show-cancel-button="true" :content="model_content" @confirm="modelConfirm" @cancel="modelCancel"></u-modal>
  103. </view>
  104. </template>
  105. <script>
  106. export default {
  107. data() {
  108. return {
  109. time_show: false,
  110. model_tag: '',
  111. model_show: false,
  112. model_content: '',
  113. bill_id: 0,
  114. bill_detail: {},
  115. goods_index: 0,
  116. warehouseLocation: ''
  117. };
  118. },
  119. onPullDownRefresh() {
  120. this.getInventoryInInfo();
  121. },
  122. computed: {
  123. userInfo() {
  124. return this.$store.state.userInfo;
  125. },
  126. shelfLifeSetUp() {
  127. return parseInt(this.$store.state.basicSet.shelfLifeSetUp);
  128. },
  129. enableLocationManagement() {
  130. return parseInt(this.$store.state.basicSet.enableLocationManagement);
  131. }
  132. },
  133. watch: {
  134. warehouseLocation(val) {
  135. if (val) {
  136. const target = this.$u.deepClone(this.bill_detail);
  137. target.details[this.goods_index] = {
  138. ...target.details[this.goods_index],
  139. areaId: val.areaId,
  140. areaName: val.areaName,
  141. areaCode: val.areaCode,
  142. storageLocationId: val.id,
  143. storageLocationName: val.name,
  144. storageLocationCode: val.code
  145. };
  146. this.bill_detail = target;
  147. }
  148. }
  149. },
  150. onLoad(options) {
  151. this.bill_id = options.id;
  152. this.getInventoryInInfo();
  153. },
  154. methods: {
  155. // 去选择库区库位页面
  156. selLocation(index) {
  157. if (this.bill_detail.auditStatus === 2) {
  158. return;
  159. }
  160. this.goods_index = index;
  161. this.goPage('/pagesT/stock/WarehouseRegion');
  162. },
  163. // 详情
  164. getInventoryInInfo() {
  165. this.$u.api
  166. .getInventoryInInfo(this.bill_id)
  167. .then(res => {
  168. uni.stopPullDownRefresh();
  169. this.bill_detail = {
  170. ...res.data,
  171. details: res.data.details.map(item => {
  172. return {
  173. ...item,
  174. inNum: item.inNum ? Number(item.inNum) : Number(item.num),
  175. otherNum: Number(item.otherNum) || 0,
  176. productionData: item.productionData || parseInt(new Date().getTime() / 1000),
  177. areaId: item.areaId || '',
  178. areaName: item.areaName || '',
  179. areaCode: item.areaCode || '',
  180. storageLocationId: item.storageLocationId || '',
  181. storageLocationName: item.storageLocationName || '',
  182. storageLocationCode: item.storageLocationCode || ''
  183. };
  184. })
  185. };
  186. })
  187. .catch(err => {
  188. uni.stopPullDownRefresh();
  189. });
  190. },
  191. openTime(index) {
  192. this.time_show = true;
  193. this.goods_index = index;
  194. },
  195. timeConfirm(obj) {
  196. const target = this.$u.deepClone(this.bill_detail);
  197. target.details[this.goods_index].productionData = obj.timestamp;
  198. this.bill_detail = target;
  199. },
  200. // 打开提示框
  201. openModel(content, tag) {
  202. this.model_content = content;
  203. this.model_show = true;
  204. this.model_tag = tag;
  205. },
  206. // 审核
  207. modelConfirm() {
  208. switch (this.model_tag) {
  209. case '审核':
  210. this.updateInventoryInStatus();
  211. break;
  212. }
  213. },
  214. modelCancel() {},
  215. // 审核订单
  216. updateInventoryInStatus() {
  217. // 开启保质期设置,进行保质期验证
  218. if (this.shelfLifeSetUp === 5) {
  219. let gindex = 0;
  220. let gdate = false;
  221. for (let i in this.bill_detail.details) {
  222. let item = this.bill_detail.details[i];
  223. if (!item.productionData) {
  224. gindex = i;
  225. gdate = true;
  226. break;
  227. }
  228. }
  229. if (gdate) {
  230. this.$u.toast(`请选择第${Number(gindex) + 1}行的生产日期`);
  231. return;
  232. }
  233. }
  234. let details = this.bill_detail.details.map(item => {
  235. let obj = {
  236. ...item,
  237. inNum: Number(item.inNum),
  238. otherNum: Number(item.otherNum),
  239. inCost: item.unitPrice,
  240. inCostTotal: item.totalPrice
  241. };
  242. // // 开启保质期设置,进行保质期验证
  243. // if (this.shelfLifeSetUp === 5) {
  244. // obj.productionData = parseInt(item.productionData / 1000);
  245. // }
  246. return obj;
  247. });
  248. let params = {
  249. id: this.bill_id,
  250. auditName: this.userInfo.name,
  251. remark: this.bill_detail.remark,
  252. details: details,
  253. costAllocation: 0,
  254. costAllocationType: ''
  255. };
  256. this.$u.api.updateInventoryInStatus(params).then(res => {
  257. this.$u.toast('审核成功');
  258. this.getInventoryInInfo();
  259. });
  260. }
  261. }
  262. };
  263. </script>
  264. <style lang="scss" scoped>
  265. .detail-view {
  266. padding-bottom: 100rpx;
  267. }
  268. .top-view {
  269. background-color: $uni-color-primary;
  270. height: 200rpx;
  271. padding: 0 30rpx;
  272. color: #ffffff;
  273. font-size: 40rpx;
  274. line-height: 100rpx;
  275. .status-text {
  276. margin-right: 10rpx;
  277. }
  278. .float_right {
  279. font-size: 28rpx;
  280. }
  281. }
  282. .detail-cont {
  283. width: 710rpx;
  284. margin: 0 auto;
  285. background-color: #ffffff;
  286. border-radius: 20rpx;
  287. padding: 20rpx 0;
  288. overflow: hidden;
  289. transform: translateY(-80rpx);
  290. .info-li {
  291. padding: 0 30rpx;
  292. line-height: 80rpx;
  293. .label {
  294. float: left;
  295. color: #6c6c6c;
  296. }
  297. .value {
  298. float: right;
  299. }
  300. .money-label {
  301. font-weight: bold;
  302. }
  303. .money-value {
  304. font-weight: bold;
  305. font-size: 30rpx;
  306. }
  307. }
  308. .remark-li {
  309. padding: 0 30rpx;
  310. .label {
  311. color: #6c6c6c;
  312. line-height: 60rpx;
  313. }
  314. }
  315. .b-b {
  316. border-bottom: 1px solid #eeeeee;
  317. }
  318. .goods-title {
  319. background-color: #5e6a84;
  320. line-height: 72rpx;
  321. width: 644rpx;
  322. margin: 30rpx auto 0;
  323. color: #ffffff;
  324. border-top-left-radius: 20rpx;
  325. border-top-right-radius: 20rpx;
  326. padding: 0 24rpx;
  327. position: relative;
  328. z-index: 1;
  329. }
  330. .goods-ul {
  331. padding: 0 30rpx 30rpx;
  332. box-shadow: 0px -3px 12rpx 0px #e4eaf5;
  333. border-bottom: 1px solid #eeeeee;
  334. .goods-li {
  335. padding-top: 24rpx;
  336. .goods-img {
  337. margin-right: 20rpx;
  338. image {
  339. width: 150rpx;
  340. height: 150rpx;
  341. border-radius: 8rpx;
  342. display: block;
  343. background-color: #f5f5f5;
  344. }
  345. }
  346. .info {
  347. .goods-name {
  348. width: 470rpx;
  349. height: 34rpx;
  350. line-height: 34rpx;
  351. }
  352. .goods-code {
  353. font-size: 24rpx;
  354. padding-top: 10rpx;
  355. }
  356. .goods-num {
  357. padding-top: 10rpx;
  358. font-size: 24rpx;
  359. .price {
  360. font-size: 28rpx;
  361. font-weight: bold;
  362. color: $uni-color-error;
  363. }
  364. }
  365. }
  366. .num-ul {
  367. display: flex;
  368. font-size: 24rpx;
  369. padding-top: 10rpx;
  370. .num-li {
  371. flex: 4;
  372. border-right: 1px solid #ecf0f7;
  373. text-align: center;
  374. padding: 0 10rpx;
  375. &:last-child {
  376. border-right: 0 none;
  377. }
  378. .label {
  379. color: #879bba;
  380. }
  381. .value {
  382. height: 40rpx;
  383. line-height: 40rpx;
  384. border-bottom: 1px solid $uni-color-primary;
  385. input {
  386. font-size: 24rpx;
  387. height: 40rpx;
  388. line-height: 40rpx;
  389. }
  390. }
  391. }
  392. }
  393. }
  394. }
  395. }
  396. </style>