_storeid.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <template>
  2. <div class="storage">
  3. <div class="com-mobile-header mobile-center-header">
  4. <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
  5. <p v-text="switchType === 'INBOUND' ? '采购入库' : '销售出库'"></p>
  6. <p class="en-name"><img :src="`/images/mobile/center/${user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}</p>
  7. </div>
  8. <div class="mobile-fix-content mobile-centerfix-content" id="mobile-storage-center">
  9. <div class="storage-record" v-if="switchType === 'INBOUND'">
  10. <div class="btn-click">
  11. <span class="base-color" @click="saveClick('INBOUND')">保存</span>
  12. <span class="clear" @click="saveClick('clear')">取消</span>
  13. </div>
  14. <div class="storage-info">
  15. <div class="linetext">入库单: <span>系统自动生成</span></div>
  16. <div class="linetext">卖家名称: <span v-text="storageList.sellername || '-'">21324</span></div>
  17. <div class="linetext">所属订单: <span v-text="storageList.orid || '-'">21324</span></div>
  18. <div class="linetext" v-if="allObj.logistics">物流公司:<span v-text="allObj.logistics.companyName"></span></div>
  19. <div class="linetext" v-if="allObj.logistics">物流单号:<span v-text="allObj.logistics.number"></span></div>
  20. <!--<div class="linetext">录入人: <span v-text="storageList.sellername || '-'">21324</span></div>-->
  21. <div class="linetext">录入时间: <span v-text="storageList.createtime ? baseUtils.formatDate(new Date(storageList.createtime), 'yyyy-MM-dd hh:mm:ss') : '-'">21324</span></div>
  22. </div>
  23. <ul class="list-unstyled" v-if="storageList.invoiceDetails" style="margin-bottom:.8rem;">
  24. <li class="info-list clearfix" v-for="(item, index) in storageList.invoiceDetails">
  25. <span class="super"><em v-text="index + 1">1</em></span>
  26. <div class="linetext width50 fl">型号: <span v-text="item.cmpCode || '-'">21324</span></div>
  27. <div class="linetext width50 fl">品牌: <span v-text="item.brandNameEn || '-'">21324</span></div>
  28. <div class="linetext width50 fl">物料名称: <span v-text="item.kiName || '-'">21324</span></div>
  29. <div class="linetext width50 fl">规格: <span v-text="item.spec || '-'">21324</span></div>
  30. <div class="linetext width50 fl">入库数(PCS):<span v-text="item.qty || '-'">-</span></div>
  31. <div class="linetext width50 fl">单价({{currency === 'RMB' ? '¥': '$'}}): <span class="base-color" v-text="item.taxUnitprice || '-'">21324</span></div>
  32. </li>
  33. </ul>
  34. </div>
  35. <div class="storage-record" v-if="switchType === 'OUTBOUND'">
  36. <div class="btn-click">
  37. <span class="base-color" @click="saveClick('OUTBOUND')">保存</span>
  38. <span class="clear" @click="saveClick('clear')">取消</span>
  39. </div>
  40. <div class="storage-info">
  41. <div class="logistics-line" v-show="showLogistics && logisticsCode">
  42. <ul class="similar">
  43. <li v-for="sCode in logisticsCode" @click.stop="setLogisticsCode(sCode.companyName)">
  44. <span v-text="sCode.companyName"></span>
  45. </li>
  46. <li v-if="logisticsCode.length <= 0"><span>请去PC端物流管理维护物流信息</span></li>
  47. </ul>
  48. </div>
  49. <div class="linetext">出库单: <span>系统自动生成</span></div>
  50. <div class="linetext">买家名称: <span v-text="storageList.buyentername || storageList.buyername">21324</span></div>
  51. <div class="linetext">所属订单: <span v-text="storageList.orderid || '-'">21324</span></div>
  52. <div class="linetext"><em>*</em>物流公司:<span>
  53. <input style="width:3rem;" type="text" readonly placeholder="请选择物流公司" v-model="allObj.logisticsInfo.companyName" @click.stop="showLogistics = !showLogistics">
  54. </span></div>
  55. <div class="linetext"><em>*</em>物流单号:<span>
  56. <input style="width:3rem;" type="text" v-model="allObj.logisticsInfo.number">
  57. </span></div>
  58. <!--<div class="linetext">录入人: <span v-text="storageList.sellername || '-'">21324</span></div>-->
  59. <div class="linetext">录入时间: <span v-text="storageList.createtime ? baseUtils.formatDate(new Date(storageList.createtime), 'yyyy-MM-dd hh:mm:ss') : '-'">21324</span></div>
  60. </div>
  61. <ul class="list-unstyled" v-if="storageList.purchaseDetails" style="margin-bottom:.8rem;">
  62. <li class="info-list clearfix" v-for="(item, index) in storageList.purchaseDetails">
  63. <span class="super"><em v-text="index + 1">1</em></span>
  64. <div class="linetext width50 fl">型号: <span v-text="item.cmpCode || '-'">21324</span></div>
  65. <div class="linetext width50 fl">品牌: <span v-text="item.brName || '-'">21324</span></div>
  66. <div class="linetext width50 fl">物料名称: <span v-text="item.kiName || '-'">21324</span></div>
  67. <div class="linetext width50 fl">规格: <span v-text="item.spec || '-'">21324</span></div>
  68. <div class="linetext width50 fl">应出库(PCS): <span v-text="item.number || '-'">21324</span></div>
  69. <div class="linetext width50 fl">已出库(PCS): <span v-text="item.shipQty || '-'">21324</span></div>
  70. <div class="linetext width50 fl">出库数(PCS):
  71. <span v-if="item.qty === item.number">-</span>
  72. <input style="width:1.2rem;" v-else type="text" v-model="item.qty" @blur="ChangeSendCount(item, item.qty)">
  73. </div>
  74. <div class="linetext width50 fl">单价(¥): <span class="base-color" v-text="item.taxUnitPrice || '-'">21324</span></div>
  75. </li>
  76. </ul>
  77. </div>
  78. </div>
  79. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  80. </div>
  81. </template>
  82. <script>
  83. import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
  84. export default {
  85. middleware: 'authenticated',
  86. layout: 'mobile',
  87. fetch({route, store}) {
  88. return route.query.type === 'INBOUND' ? Promise.all([
  89. store.dispatch('product/getLoadEnterpriseId', {id:route.params.storeid}),
  90. store.dispatch('loadCurrencyData')
  91. ]) : Promise.all([
  92. store.dispatch('product/getLoadPurchaseId', {id:route.params.storeid}),
  93. store.dispatch('product/getLoadLogistics', {count:30, page: 1}),
  94. store.dispatch('loadCurrencyData')
  95. ])
  96. },
  97. data () {
  98. return {
  99. remindText: '',
  100. timeoutCount: 0,
  101. switchType: this.$route.query.type,
  102. storageList: {},
  103. showLogistics: false,
  104. allObj:{
  105. logisticsInfo: {},
  106. map: []
  107. }
  108. }
  109. },
  110. components: {
  111. RemindBox,
  112. PullUp,
  113. EmptyStatus
  114. },
  115. mounted () {
  116. let data = this.$store.state.product.storage.detail.data
  117. this.storageList = data ? JSON.parse(JSON.stringify(this.$store.state.product.storage.detail.data)) : {}
  118. let _this = this
  119. document.body.onclick = function() {
  120. _this.showLogistics = false
  121. }
  122. },
  123. computed: {
  124. logisticsCode () {
  125. return this.$store.state.product.storage.logistics.data
  126. }
  127. },
  128. methods: {
  129. onRemind: function (str) {
  130. this.remindText = str
  131. this.timeoutCount++
  132. },
  133. setFilterType (type) {
  134. let bound = ''
  135. if(type === 'OTHER_INBOUND') {
  136. bound = '其他入库'
  137. } else if(type === 'OTHER_OUTBOUND'){
  138. bound = '其他出库'
  139. } else if (type === 'PURCHASE_INBOUND') {
  140. bound = '采购入库'
  141. } else if(type === 'SELL_OUTBOUND') {
  142. bound = '销售出库'
  143. } else {
  144. bound = '全部类型'
  145. }
  146. return bound
  147. },
  148. ChangeSendCount (type, val) {
  149. let newShipQty = type.shipQty ? type.shipQty : 0
  150. if (val > type.number - newShipQty) {
  151. this.onRemind('本次发货数量不能大于已剩数量')
  152. val = type.number - newShipQty
  153. }
  154. type.qty = val
  155. },
  156. setLogisticsCode (val) {
  157. this.showLogistics = false
  158. this.allObj.logisticsInfo.companyName = val
  159. },
  160. saveClick (type) {
  161. if(type === 'clear') {
  162. this.$router.push(`/mobile/center/${this.switchType === 'OUTBOUND' ? 'vendor' : 'user'}/outOfStorage?providerType=person&handleItem=2&type=${this.$route.query.type}`)
  163. }else if(type === 'OUTBOUND'){
  164. if(!this.allObj.logisticsInfo.companyName) {
  165. this.onRemind('请先选择物流公司')
  166. } else if(!this.allObj.logisticsInfo.number) {
  167. this.onRemind('请填写物流单号')
  168. } else {
  169. let arr = []
  170. this.storageList.purchaseDetails.forEach(val => {
  171. if(val.qty) {
  172. arr.push({id: val.id, qty: Number(val.qty)})
  173. }
  174. })
  175. if(arr.length <= 0) {
  176. this.onRemind('最少填写一个发货数量')
  177. } else {
  178. this.allObj.sendType = this.storageList.sendType
  179. this.allObj.map = arr
  180. this.allObj.jsonSdAddress = this.storageList.jsonAddress
  181. this.$http.post(`/trade/invoice/inFpu/save?id=${this.storageList.id}`, this.allObj)
  182. .then(response => {
  183. if(response.data.code === 1){
  184. this.onRemind('保存信息成功')
  185. setTimeout(() => {
  186. this.$router.push(`/mobile/center/vendor/outOfStorage?providerType=person&handleItem=2&type=${this.$route.query.type}`)
  187. }, 1000)
  188. } else {
  189. this.onRemind('保存信息失败')
  190. }
  191. }).catch(err => {
  192. this.onRemind('保存信息失败')
  193. })
  194. }
  195. }
  196. } else if(type === 'INBOUND') {
  197. this.$http.put(`/trade/order/signReceive?_status=ensureaccept&invoiceId=${this.storageList.invoiceid}`)
  198. .then(response => {
  199. if(response.data.code === 1){
  200. this.onRemind('保存信息成功')
  201. setTimeout(() => {
  202. this.$router.push(`/mobile/center/user/outOfStorage?providerType=person&handleItem=2&type=${this.$route.query.type}`)
  203. }, 1000)
  204. } else {
  205. this.onRemind('保存信息失败')
  206. }
  207. }).catch(err => {
  208. this.onRemind('保存信息失败')
  209. })
  210. }
  211. }
  212. }
  213. }
  214. </script>
  215. <style lang="scss" scoped>
  216. $base-color: #3f84f6;
  217. $title-color: #ffa200;
  218. $red-color: #ff0000;
  219. #mobile-storage-center {
  220. padding-bottom: .5rem;
  221. margin: 0 auto;
  222. }
  223. .storage-record{
  224. padding: 0.24rem 0.24rem;
  225. margin: 0 auto;
  226. .btn-click{
  227. padding: 0.24rem 0.24rem;
  228. position: fixed;
  229. bottom: 1rem;
  230. left: 0;
  231. right: 0;
  232. text-align: center;
  233. background: #f1f3f6;
  234. span{
  235. display:inline-block;
  236. width:30%;
  237. height: .6rem;
  238. line-height: .6rem;
  239. margin: 0 .1rem;
  240. border-radius:.05rem;
  241. &.clear{
  242. color:#fafbfc;
  243. background: #b5b5b5;
  244. }
  245. &.base-color{
  246. color:#fff;
  247. background: $base-color;
  248. }
  249. }
  250. }
  251. .storage-info{
  252. position:relative;
  253. padding: 0.24rem 0.24rem;
  254. background: #fff;
  255. margin-bottom:.2rem;
  256. .logistics-line{
  257. position: absolute;
  258. top: 2.6rem;
  259. left: 1.75rem;
  260. border: 1px solid $base-color;
  261. border-radius: .04rem;
  262. width: 3rem;
  263. background: #fff;
  264. z-index: 1;
  265. max-height: 3.96rem;
  266. overflow-y: auto;
  267. .similar {
  268. li {
  269. height: .66rem;
  270. line-height: .66rem;
  271. padding: 0 .19rem;
  272. font-size: .24rem;
  273. &:active, &:focus {
  274. background: #f7f7f7;
  275. }
  276. }
  277. }
  278. }
  279. }
  280. .linetext{
  281. color:#666;
  282. line-height: .6rem;
  283. overflow: hidden;
  284. -o-text-overflow: ellipsis;
  285. text-overflow: ellipsis;
  286. white-space: nowrap;
  287. em{
  288. color:$red-color;
  289. }
  290. input{
  291. height: .5rem;
  292. font-size: .24rem;
  293. border-radius: .04rem;
  294. border: 1px solid #d2d2d2;
  295. padding: 0 .1rem;
  296. }
  297. input[readonly] {
  298. padding: 0 .2rem;
  299. background: url('/images/mobile/select-arrow.png') no-repeat;
  300. background-size: .24rem .15rem;
  301. background-position: 2.6rem .2rem;
  302. }
  303. span{
  304. color:#333;
  305. &.base-color{
  306. color:$base-color;
  307. }
  308. }
  309. }
  310. .info-list{
  311. position:relative;
  312. padding: 0.3rem 0.24rem;
  313. background: #fff;
  314. margin-bottom:.2rem;
  315. .width50{
  316. display:inline-block;
  317. width: 48%;
  318. margin-left: .1rem;
  319. }
  320. >span{
  321. display:inline-block;
  322. position:absolute;
  323. left:0;
  324. top:0;
  325. padding: 0 .1rem;
  326. background: $title-color;
  327. border-radius: 0 .5rem .5rem 0;
  328. line-height: .3rem;
  329. height:.3rem;
  330. color:#fff;
  331. font-size: .24rem;
  332. }
  333. }
  334. }
  335. </style>