_storeid.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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. console.log(type)
  179. this.allObj.sendType = this.storageList.sendType
  180. this.allObj.map = arr
  181. this.allObj.jsonSdAddress = this.storageList.jsonAddress
  182. this.$http.post(`/trade/invoice/inFpu/save?id=${this.storageList.id}`, this.allObj)
  183. .then(response => {
  184. if(response.data.code === 1){
  185. this.onRemind('保存信息成功')
  186. setTimeout(() => {
  187. this.$router.push(`/mobile/center/vendor/outOfStorage?providerType=person&handleItem=2&type=${this.$route.query.type}`)
  188. }, 1000)
  189. } else {
  190. this.onRemind('保存信息失败')
  191. }
  192. }).catch(err => {
  193. this.onRemind('保存信息失败')
  194. })
  195. }
  196. }
  197. } else if(type === 'INBOUND') {
  198. this.$http.put(`/trade/order/signReceive?_status=ensureaccept&invoiceId=${this.storageList.invoiceid}`)
  199. .then(response => {
  200. if(response.data.code === 1){
  201. this.onRemind('保存信息成功')
  202. setTimeout(() => {
  203. this.$router.push(`/mobile/center/user/outOfStorage?providerType=person&handleItem=2&type=${this.$route.query.type}`)
  204. }, 1000)
  205. } else {
  206. this.onRemind('保存信息失败')
  207. }
  208. }).catch(err => {
  209. this.onRemind('保存信息失败')
  210. })
  211. }
  212. }
  213. }
  214. }
  215. </script>
  216. <style lang="scss" scoped>
  217. $base-color: #3f84f6;
  218. $title-color: #ffa200;
  219. $red-color: #ff0000;
  220. #mobile-storage-center {
  221. padding-bottom: .5rem;
  222. margin: 0 auto;
  223. }
  224. .storage-record{
  225. padding: 0.24rem 0.24rem;
  226. margin: 0 auto;
  227. .btn-click{
  228. padding: 0.24rem 0.24rem;
  229. position: fixed;
  230. bottom: 1rem;
  231. left: 0;
  232. right: 0;
  233. text-align: center;
  234. background: #f1f3f6;
  235. span{
  236. display:inline-block;
  237. width:30%;
  238. height: .6rem;
  239. line-height: .6rem;
  240. margin: 0 .1rem;
  241. border-radius:.05rem;
  242. &.clear{
  243. color:#fafbfc;
  244. background: #b5b5b5;
  245. }
  246. &.base-color{
  247. color:#fff;
  248. background: $base-color;
  249. }
  250. }
  251. }
  252. .storage-info{
  253. position:relative;
  254. padding: 0.24rem 0.24rem;
  255. background: #fff;
  256. margin-bottom:.2rem;
  257. .logistics-line{
  258. position: absolute;
  259. top: 2.6rem;
  260. left: 1.75rem;
  261. border: 1px solid $base-color;
  262. border-radius: .04rem;
  263. width: 3rem;
  264. background: #fff;
  265. z-index: 1;
  266. max-height: 3.96rem;
  267. overflow-y: auto;
  268. .similar {
  269. li {
  270. height: .66rem;
  271. line-height: .66rem;
  272. padding: 0 .19rem;
  273. font-size: .24rem;
  274. &:active, &:focus {
  275. background: #f7f7f7;
  276. }
  277. }
  278. }
  279. }
  280. }
  281. .linetext{
  282. color:#666;
  283. line-height: .6rem;
  284. overflow: hidden;
  285. -o-text-overflow: ellipsis;
  286. text-overflow: ellipsis;
  287. white-space: nowrap;
  288. em{
  289. color:$red-color;
  290. }
  291. input{
  292. height: .5rem;
  293. font-size: .24rem;
  294. border-radius: .04rem;
  295. border: 1px solid #d2d2d2;
  296. padding: 0 .1rem;
  297. }
  298. input[readonly] {
  299. padding: 0 .2rem;
  300. background: url('/images/mobile/select-arrow.png') no-repeat;
  301. background-size: .24rem .15rem;
  302. background-position: 2.6rem .2rem;
  303. }
  304. span{
  305. color:#333;
  306. &.base-color{
  307. color:$base-color;
  308. }
  309. }
  310. }
  311. .info-list{
  312. position:relative;
  313. padding: 0.3rem 0.24rem;
  314. background: #fff;
  315. margin-bottom:.2rem;
  316. .width50{
  317. display:inline-block;
  318. width: 48%;
  319. margin-left: .1rem;
  320. }
  321. >span{
  322. display:inline-block;
  323. position:absolute;
  324. left:0;
  325. top:0;
  326. padding: 0 .1rem;
  327. background: $title-color;
  328. border-radius: 0 .5rem .5rem 0;
  329. line-height: .3rem;
  330. height:.3rem;
  331. color:#fff;
  332. font-size: .24rem;
  333. }
  334. }
  335. }
  336. </style>