storeReceipt.vue 26 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  1. <template>
  2. <div class="form-submit">
  3. <div class="i-layout-page-header">
  4. <PageHeader class="product_tabs" hidden-breadcrumb>
  5. <div slot="title">
  6. <router-link :to="{ path: `${roterPre}/erp/out_list` }">
  7. <!-- <Button icon="ios-arrow-back" size="small" class="mr20"
  8. >返回</Button
  9. > -->
  10. <div class="font-sm after-line">
  11. <span class="iconfont iconfanhui"></span>
  12. <span class="pl10">返回</span>
  13. </div>
  14. </router-link>
  15. <span v-text="type == 1 ?'门店收货':'添加入库'" class="mr20 ml16"></span>
  16. </div>
  17. </PageHeader>
  18. </div>
  19. <Card :bordered="false" dis-hover class="ivu-mt">
  20. <Form class="formValidate mt20" ref="formValidate" :rules="ruleValidate" :model="formValidate"
  21. :label-width="labelWidth" :label-position="labelPosition" @submit.native.prevent>
  22. <Row :gutter="24" type="flex">
  23. <Col span="24">
  24. <FormItem label="出库单号: " prop="out_order_id">
  25. <div>{{formValidate.out_order_id}}</div>
  26. </FormItem>
  27. </Col>
  28. <Col span="24">
  29. <FormItem label="运费: " prop="freight">
  30. <Input v-model="formValidate.freight" placeholder="请输入运费" v-width="'150'" type="number" />
  31. </FormItem>
  32. </Col>
  33. <Col span="24">
  34. <FormItem label="创建人:" prop="create_uid" v-if="type == 1">
  35. <el-cascader placeholder="请选择创建人" class="input-add" size="mini"
  36. v-model="formValidate.create_uid" :options="authList" :props="propsss"
  37. @change="userSearchsss" filterable clearable v-width="'400'">
  38. </el-cascader>
  39. </FormItem>
  40. </Col>
  41. <Col span="24">
  42. <FormItem label="商品:" prop="goods">
  43. <Card>
  44. <div class="user-info" v-for="(goods,gindex) in chooseGoods">
  45. <!-- <Button type="primary" @click="delGood(gindex)" class="del-btn">删除</Button> -->
  46. <div class="section-hd">{{goods.product_name}}</span> </div>
  47. <div v-if="goods.group.length > 0 && type == 1" v-for="(item,index) in goods.group"
  48. class="section">
  49. <div class="section-bd">
  50. <div class="item">
  51. <div>批次编号:</div>
  52. <div class="value">{{ item.batch_code || '/'}}</div>
  53. </div>
  54. <div class="item">
  55. <div>单价(元/{{item.unit_name}}):</div>
  56. <div class="value">{{ item.price}}</div>
  57. </div>
  58. <!-- <div class="item">
  59. <div>是否称重:</div>
  60. <div class="value">{{ item.is_weigh == 1? '是':'否'}}</div>
  61. </div> -->
  62. <div class="item">
  63. <div>数量({{ item.unit_name}}):</div>
  64. <div class="value">
  65. {{item.pur_number}}
  66. </div>
  67. </div>
  68. <div class="item" v-if="item.is_weigh == 1">
  69. <div>总重量(kg):</div>
  70. <div class="value">{{item.weight}}</div>
  71. </div>
  72. <div class="item" v-if="item.is_weigh == 1">
  73. <div>皮重(kg):</div>
  74. <div class="value"><Input
  75. v-model="chooseGoods[gindex].group[index].tare_weight"
  76. placeholder="请输入皮重" v-width="'150'" type="number" /></div>
  77. </div>
  78. <div class="item" v-if="item.is_weigh == 1">
  79. <div>净重(kg):</div>
  80. <div class="value"><Input
  81. v-model="chooseGoods[gindex].group[index].net_weight"
  82. placeholder="请输入净重" v-width="'150'" type="number" /></div>
  83. </div>
  84. <!-- <a v-if="goods.group.length > 1" @click="delBatch(gindex,index)" class=" del-btn-1">删除</a> -->
  85. </div>
  86. </div>
  87. <div class="section" v-if="type == 2">
  88. <div class="section-bd">
  89. <div class="item">
  90. <div>仓位:</div>
  91. <div class="value" v-if="goods.bin_number">{{goods.bin_number}}</div>
  92. <el-cascader placeholder="请选择仓位" v-if="!goods.bin_number" class="value"
  93. size="mini" v-model="goods.bin_number" :options="positionList"
  94. :props="props" filterable clearable v-width="'400'">
  95. </el-cascader>
  96. <a @click="addPosition" v-if="!goods.bin_number">添加仓位</a>
  97. </div>
  98. </div>
  99. </div>
  100. <div v-if="goods.batchs.length > 0 && type == 2" v-for="(item,index) in goods.batchs"
  101. class="section">
  102. <div class="section-bd">
  103. <div class="item">
  104. <div>批次编号:</div>
  105. <div class="value">{{ item.batch_code || '/'}}</div>
  106. </div>
  107. <div class="item">
  108. <div>单价(元/{{item.unit_name}}):</div>
  109. <div class="value">{{ item.price}}</div>
  110. </div>
  111. <div class="item">
  112. <div>数量({{ item.unit_name}}):</div>
  113. <div class="value">
  114. {{item.pur_number}}
  115. </div>
  116. </div>
  117. <div class="item" v-if="item.is_weigh == 1">
  118. <div>总重量(kg):</div>
  119. <div class="value">{{item.weight}}</div>
  120. </div>
  121. <div class="item" v-if="item.is_weigh == 1">
  122. <div>皮重(kg):</div>
  123. <div class="value"><Input
  124. v-model="chooseGoods[gindex].batchs[index].tare_weight"
  125. placeholder="请输入皮重" v-width="'150'" type="number" /></div>
  126. </div>
  127. <div class="item" v-if="item.is_weigh == 1">
  128. <div>净重(kg):</div>
  129. <div class="value"><Input
  130. v-model="chooseGoods[gindex].batchs[index].net_weight"
  131. placeholder="请输入净重" v-width="'150'" type="number" /></div>
  132. </div>
  133. <!-- <a v-if="goods.group.length > 1" @click="delBatch(gindex,index)" class=" del-btn-1">删除</a> -->
  134. </div>
  135. </div>
  136. </div>
  137. </Card>
  138. <!-- <Button type="primary" class="submission" style="margin-top:20px;" @click="getGoods()"
  139. >添加商品</Button> -->
  140. </FormItem>
  141. </Col>
  142. </Row>
  143. </Form>
  144. </Card>
  145. <Card :bordered="false" dis-hover class="fixed-card"
  146. :style="{ left: `${!menuCollapse ? '200px' : isMobile ? '0' : '80px'}` }">
  147. <Form>
  148. <FormItem>
  149. <Button type="primary" class="submission" @click="handleSubmit('formValidate')">保存</Button>
  150. </FormItem>
  151. </Form>
  152. </Card>
  153. <good-detail ref="goodDetail" @setGoods="setGoods"></good-detail>
  154. <Modal v-model="modalPosition" scrollable title="添加仓位" class="order_box" :closable="false"
  155. :mask-closable="false">
  156. <Form ref="remarks" :model="remarks" :rules="rulePosition" :label-width="100" @submit.native.prevent>
  157. <Col span="24">
  158. <FormItem label="仓位名称:" prop="title">
  159. <Input v-model="remarks.title" placeholder="请输入仓位名称/编号" v-width="'200'" />
  160. </FormItem>
  161. </Col>
  162. <Col span="24">
  163. <FormItem label="通道:" prop="passageway">
  164. <Input v-model="remarks.passageway" placeholder="请输入通道" type="number" v-width="'200'"
  165. :disabled="remarks.id != 0" /> (1~99)
  166. </FormItem>
  167. </Col>
  168. <Col span="24">
  169. <FormItem label="左右:" prop="control">
  170. <RadioGroup v-model="remarks.control">
  171. <Radio label="L" :disabled="remarks.id != 0">
  172. <Icon type="social-apple"></Icon>
  173. <span>左</span>
  174. </Radio>
  175. <Radio label="R" :disabled="remarks.id != 0">
  176. <Icon type="social-android"></Icon>
  177. <span>右</span>
  178. </Radio>
  179. </RadioGroup>
  180. </FormItem>
  181. </Col>
  182. <Col span="24">
  183. <FormItem label="层数:" prop="layer">
  184. <Input v-model="remarks.layer" placeholder="请输入层数" type="number" v-width="'200'"
  185. :disabled="remarks.id != 0" /> (1~9)
  186. </FormItem>
  187. </Col>
  188. <Col span="24">
  189. <FormItem label="仓位编号:" prop="number">
  190. <Input v-model="remarks.number" placeholder="请输入仓位编号" type="number" v-width="'200'"
  191. :disabled="remarks.id != 0" /> (1~999)
  192. </FormItem>
  193. </Col>
  194. </Form>
  195. <div slot="footer">
  196. <Button type="primary" @click="putRemark()">提交</Button>
  197. <Button @click="cancel()">取消</Button>
  198. </div>
  199. </Modal>
  200. </div>
  201. </template>
  202. <script>
  203. import {
  204. mapState,
  205. mapMutations
  206. } from "vuex";
  207. import {
  208. staffListInfo
  209. } from "@/api/store";
  210. import {
  211. wareDelivery,
  212. getGodownList,
  213. createGodown,
  214. getGodownInfo,
  215. getUserList,
  216. getOutGoods,
  217. createWant,
  218. getWantInfo,
  219. getProductBatch,
  220. createOut,
  221. storeReceipt,
  222. getOutInfo,
  223. getOutSimpleList,
  224. getPositionList,
  225. createPosition
  226. } from "@/api/erp";
  227. import {
  228. keyApi,
  229. storeGetInfoApi,
  230. cityApi,
  231. storeUpdateApi,
  232. cascaderList
  233. } from '@/api/store';
  234. import {
  235. productSpecs,
  236. productSpecsInfo
  237. } from "@/api/product";
  238. import Setting from "@/setting";
  239. import goodDetail from './goodDetail.vue'
  240. const jy = (min, max) => {
  241. return {
  242. validator(rule, value) {
  243. if (!value || value > max || value < min) {
  244. return [{
  245. message: `范围为${min}~${max}`
  246. }];
  247. } else {
  248. return [];
  249. }
  250. }
  251. }
  252. }
  253. export default {
  254. name: "specsAdd",
  255. components: {
  256. goodDetail
  257. },
  258. data() {
  259. return {
  260. type: 0,
  261. info: {},
  262. loading: false,
  263. authList: [],
  264. chooseGoods: [],
  265. staffData: [],
  266. addresData: [],
  267. props: {
  268. emitPath: false,
  269. multiple: false,
  270. checkStrictly: true,
  271. value: "bin_number",
  272. label: "bin_number"
  273. },
  274. propss: {
  275. emitPath: false,
  276. multiple: false,
  277. checkStrictly: true,
  278. value: "id",
  279. label: "name"
  280. },
  281. propsss: {
  282. emitPath: false,
  283. multiple: false,
  284. checkStrictly: true,
  285. value: "id",
  286. label: "staff_name"
  287. },
  288. roterPre: Setting.roterPre,
  289. data1: [],
  290. grid: {
  291. xl: 7,
  292. lg: 7,
  293. md: 12,
  294. sm: 24,
  295. xs: 24,
  296. },
  297. formValidate: {
  298. freight: 0,
  299. out_order_id: '',
  300. id: 0,
  301. wid: 0,
  302. store_id: 0,
  303. goods: [],
  304. my_store_id: 0,
  305. create_uid: 0,
  306. create_admin_id: 0,
  307. },
  308. ruleValidate: {
  309. // freight: [{
  310. // type: "number",
  311. // required: true,
  312. // message: "输入运费",
  313. // trigger: "blur"
  314. // }, ],
  315. },
  316. rulePosition: {
  317. title: [{
  318. required: true,
  319. message: "请输入仓位名称",
  320. trigger: "blur"
  321. }, ],
  322. wid: [{
  323. required: true,
  324. message: "请选择仓库",
  325. trigger: "blur"
  326. }, ],
  327. passageway: [{
  328. required: true,
  329. message: "请输入通道",
  330. trigger: "blur"
  331. }, jy(1, 99)],
  332. control: [{
  333. required: true,
  334. message: "请选择左右",
  335. trigger: "blur"
  336. }, ],
  337. layer: [{
  338. required: true,
  339. message: '请输入层数',
  340. trigger: 'blur',
  341. }, jy(1, 9)],
  342. number: [{
  343. required: true,
  344. message: '请输入仓位编号',
  345. trigger: 'blur',
  346. }, jy(1, 999)],
  347. },
  348. positionList: [],
  349. modalPosition: false,
  350. remarks: {
  351. id: 0,
  352. title: "",
  353. wid: '0',
  354. passageway: '',
  355. control: "L",
  356. layer: '',
  357. number: ''
  358. },
  359. };
  360. },
  361. computed: {
  362. ...mapState("admin/layout", ["isMobile", "menuCollapse"]),
  363. labelWidth() {
  364. return this.isMobile ? undefined : 120;
  365. },
  366. labelPosition() {
  367. return this.isMobile ? "top" : "right";
  368. },
  369. },
  370. created() {
  371. this.getGodownList()
  372. let data = {
  373. pid: 0
  374. }
  375. // this.cityInfo(data);
  376. },
  377. mounted() {
  378. // this.setCopyrightShow({
  379. // value: false
  380. // });
  381. this.staffList()
  382. if (this.$route.query.id != 0) {
  383. this.formValidate.out_order_id = this.$route.query.id
  384. this.type = this.$route.query.type
  385. this.getOutSimpleList(this.$route.query.id)
  386. }
  387. },
  388. destroyed() {
  389. // this.setCopyrightShow({
  390. // value: true
  391. // });
  392. },
  393. methods: {
  394. ...mapMutations("admin/layout", ["setCopyrightShow"]),
  395. addPosition() {
  396. this.modalPosition = true
  397. this.remarks.wid = this.formValidate.wid
  398. },
  399. putRemark() {
  400. this.$refs.remarks.validate((valid) => {
  401. if (valid) {
  402. // this.remarks.id = this.$route.query.id;
  403. createPosition({
  404. id: this.remarks.id,
  405. title: this.remarks.title,
  406. wid: this.remarks.wid,
  407. passageway: this.remarks.passageway,
  408. control: this.remarks.control,
  409. layer: this.remarks.layer,
  410. number: this.remarks.number
  411. }).then(res => {
  412. this.$Message.success(res.msg);
  413. this.getPositionList()
  414. this.cancel()
  415. // this.$router.push({
  416. // path: this.roterPre + "/erp/position_list"
  417. // });
  418. }).catch(err => {
  419. this.$Message.error(err.msg);
  420. })
  421. } else {
  422. // this.$Message.error("请输入参数模板名称");
  423. }
  424. });
  425. },
  426. cancel() {
  427. this.modalPosition = false
  428. this.remarks = {
  429. id: 0,
  430. title: "",
  431. wid: '0',
  432. passageway: '',
  433. control: "L",
  434. layer: '',
  435. number: ''
  436. }
  437. },
  438. getPositionList() {
  439. getPositionList({
  440. wid: this.formValidate.wid,
  441. not_used: 1,
  442. page: 1,
  443. limit: 1000
  444. }).then(res => {
  445. this.positionList = res.data.data
  446. })
  447. },
  448. delGood(index) {
  449. this.chooseGoods.splice(index, 1)
  450. },
  451. delBatch(in1, in2) {
  452. console.log((in1, in2));
  453. this.chooseGoods[in1].batch.splice(in2, 1)
  454. },
  455. jyNum(a = 0, b = 0, item) {
  456. console.log(a, b, 'jiaoyan');
  457. if (a * 1 < b * 1) {
  458. item.pur_number = 0
  459. return this.$Message.error('输入值大于可调出商品的库存')
  460. }
  461. },
  462. getOutSimpleList(id) {
  463. getOutSimpleList(id).then(res => {
  464. getOutSimpleList({
  465. out_order_id: id,
  466. type: this.type
  467. }).then(res => {
  468. console.log(res);
  469. this.info = res.data.data[0]
  470. if (this.type == 1) {
  471. this.chooseGoods = this.info.product.map(item => {
  472. let obj = {
  473. bar_code: item.bar_code,
  474. product_code: item.product_code || "",
  475. product_id: item.id,
  476. product_name: item.store_name,
  477. group: item.group.map(e => {
  478. let ob = {
  479. batch_code: e.batch_code,
  480. is_weigh: e.is_weigh,
  481. net_weight: '',
  482. price: e.price,
  483. pur_number: e.pur_number,
  484. rate: e.rate,
  485. shelf_life: e.shelf_life,
  486. tare_weight: '',
  487. unit_name: e.unit_name,
  488. unit_type: e.unit_type,
  489. weight: e.weight,
  490. }
  491. return ob
  492. })
  493. }
  494. return obj
  495. })
  496. } else {
  497. this.chooseGoods = this.info.product.map(item => {
  498. let obj = {
  499. bin_number: item.bin_number,
  500. bar_code: item.bar_code,
  501. product_code: item.product_code || "",
  502. product_id: item.id,
  503. product_name: item.store_name,
  504. total_price: item.total_price,
  505. pur_number: item.pur_number,
  506. unit_type: 0,
  507. unit_name: item.p_unit_name,
  508. batchs: item.group.map(e => {
  509. let ob = {
  510. batch_code: e.batch_code,
  511. is_weigh: e.is_weigh,
  512. net_weight: '',
  513. price: e.price,
  514. pur_number: e.pur_number,
  515. rate: e.rate,
  516. shelf_life: e.shelf_life,
  517. tare_weight: '',
  518. unit_name: e.unit_name,
  519. unit_type: e.unit_type,
  520. weight: e.weight,
  521. }
  522. return ob
  523. })
  524. }
  525. return obj
  526. })
  527. console.log(this.chooseGoods, 'batchs');
  528. }
  529. if (this.type == 1) {
  530. this.formValidate.to_store_id = this.info.to_store_id * 1
  531. this.getUserList()
  532. } else {
  533. this.formValidate.wid = this.info.to_wid * 1
  534. this.getPositionList()
  535. this.getUserList()
  536. }
  537. // that
  538. })
  539. // let data = res.data
  540. // if (data.wid) {
  541. // this.formValidate.outType = 0
  542. // this.formValidate.wid = data.wid*1
  543. // } else {
  544. // this.formValidate.outType = 1
  545. // this.formValidate.store_id = data.store_id*1
  546. // }
  547. // if (data.to_wid) {
  548. // this.formValidate.to_wid = data.to_wid*1
  549. // this.formValidate.inType == 0
  550. // } else {
  551. // this.formValidate.inType == 1
  552. //
  553. // }
  554. // this.getUserList()
  555. // this.formValidate.create_uid = data.create_uid
  556. // this.formValidate.create_admin_id = data.create_admin_id
  557. // this.chooseGoods = data.product.map(item => {
  558. // item.name = item.store_name
  559. // item.product_id = item.id
  560. // if(item.group.length > 0) {
  561. // item.batch = item.group
  562. // }else {
  563. // item.batch = []
  564. // }
  565. // return item
  566. // })
  567. // console.log(res, 'ddddd');
  568. // let data = res.data
  569. // this.formValidate.id = data.id
  570. // this.formValidate.create_uid = data.create_uid
  571. // this.chooseGoods = data.info
  572. // this.formValidate.store_id = data.store_id
  573. // console.log(this.formValidate.goods, 'this.formValidate.goods');
  574. // if (data.wid) {
  575. // this.formValidate.inType = 0
  576. // this.formValidate.wid = data.wid
  577. // this.getUserList({
  578. // wid: this.formValidate.wid
  579. // })
  580. // } else {
  581. // this.formValidate.inType = 1
  582. // this.getUserList({
  583. // store_id: this.formValidate.store_id
  584. // })
  585. // }
  586. })
  587. },
  588. setGoods(e) {
  589. console.log(e, 'ddd');
  590. // try {
  591. // let arr = e.map(item => {
  592. // item.unitList = [{
  593. // value: 0,
  594. // label: item.info.unit_name
  595. // }]
  596. // if (item.info.unit_name_1) {
  597. // item.unitList.push({
  598. // value: 1,
  599. // label: item.info.unit_name_1
  600. // })
  601. // }
  602. // if (item.info.unit_name_2) {
  603. // item.unitList.push({
  604. // value: 2,
  605. // label: item.info.unit_name_1
  606. // })
  607. // }
  608. // item.want_product_num = 0
  609. // return item
  610. // })
  611. // this.chooseGoods = this.chooseGoods.concat(arr)
  612. // } catch (e) {
  613. // //TODO handle the exception
  614. // console.log('err', e);
  615. // }
  616. // console.log(this.chooseGoods, 'this.chooseGoods');
  617. // 校验商品是否重复
  618. if (this.chooseGoods.find(item => e.product_id == item.product_id)) {
  619. console.log('55');
  620. this.$refs.goodDetail.clearAll()
  621. return this.$Message.error('该商品已选择');
  622. } else {
  623. this.$refs.goodDetail.modals = false
  624. let qdata;
  625. console.log('this.formValidate.outType', this.formValidate.outType);
  626. if (this.formValidate.outType == 1) {
  627. try {
  628. qdata = {
  629. store_id: this.formValidate.store_id,
  630. product_id: e.product_id
  631. }
  632. } catch (e) {
  633. //TODO handle the exception
  634. console.log('err', e);
  635. }
  636. } else {
  637. qdata = {
  638. wid: this.formValidate.wid,
  639. product_id: e.product_id
  640. }
  641. }
  642. console.log(qdata, 'qdata');
  643. getProductBatch(qdata).then(res => {
  644. if (res.data.length > 0) {
  645. this.chooseGoods = this.chooseGoods.concat({
  646. bar_code: e.bar_code,
  647. is_weigh: e.info.is_weigh,
  648. name: e.product_name,
  649. product_id: e.product_id,
  650. product_num: e.product_num,
  651. pur_number: '',
  652. unit_name: e.unit_name,
  653. weight: '',
  654. batch: res.data.map(item => {
  655. item.weight = 0
  656. item.pur_number = 0
  657. return item
  658. })
  659. })
  660. } else {
  661. this.chooseGoods = this.chooseGoods.concat({
  662. bar_code: e.bar_code,
  663. is_weigh: e.info.is_weigh,
  664. name: e.product_name,
  665. product_id: e.product_id,
  666. product_num: e.product_num,
  667. pur_number: 0,
  668. unit_name: e.unit_name,
  669. weight: 0,
  670. batch: []
  671. })
  672. }
  673. })
  674. // this.chooseGoods = this.chooseGoods.concat(e)
  675. }
  676. },
  677. getGoods() {
  678. console.log(this.formValidate.store_id, this.formValidate.wid);
  679. if (this.formValidate.wid == 0 && this.formValidate.store_id == 0) {
  680. return this.$Message.error('请选择调出仓库或门店');
  681. }
  682. try {
  683. this.$refs.goodDetail.formValidate.outType = this.formValidate.outType
  684. this.$refs.goodDetail.formValidate.wid = this.formValidate.wid
  685. this.$refs.goodDetail.formValidate.store_id = this.formValidate.store_id
  686. this.$refs.goodDetail.modals = true
  687. this.$refs.goodDetail.getList()
  688. } catch (e) {
  689. //TODO handle the exception
  690. console.log('err', e);
  691. }
  692. },
  693. getUserList() {
  694. let qdata = {}
  695. if (this.type == 1) {
  696. // if (this.formValidate.outType == 1) {
  697. // qdata.store_id = this.formValidate.store_id
  698. // } else {
  699. // qdata.wid = this.formValidate.wid
  700. // }
  701. qdata.store_id = this.formValidate.to_store_id
  702. } else {
  703. qdata.wid = this.formValidate.wid
  704. }
  705. getUserList(qdata).then(res => {
  706. // console.log(res);
  707. this.authList = res.data.data
  708. // .map(item => {
  709. // item.id += ''
  710. // return item
  711. // });
  712. })
  713. },
  714. staffList() {
  715. staffListInfo()
  716. .then((res) => {
  717. this.staffData = res.data
  718. // .map(item => {
  719. // item.id += ''
  720. // return item
  721. // });
  722. })
  723. .catch((err) => {
  724. this.$Message.error(err.msg);
  725. });
  726. },
  727. getGodownInfo(id) {
  728. getGodownInfo(id).then(res => {
  729. this.formValidate = res.data
  730. this.formValidate.addressSelect = this.formValidate.addressSelect.map(item => item * 1)
  731. console.log(this.formValidate.addressSelect);
  732. })
  733. },
  734. addchack(e, selectedData) {
  735. console.log(selectedData, 'selectedData');
  736. e.forEach((i, index) => {
  737. if (index == 0) {
  738. this.formValidate.province = i
  739. } else if (index == 1) {
  740. this.formValidate.city = i
  741. } else if (index == 2) {
  742. this.formValidate.area = i
  743. } else {
  744. this.formValidate.street = i
  745. }
  746. })
  747. this.formValidate.address = (selectedData.map(o => o.label)).join('/')
  748. // console.log('this.formValidate.addressSelect',this.formValidate.addressSelect);
  749. },
  750. cityInfo(data) {
  751. cityApi(data).then(res => {
  752. this.addresData = res.data
  753. })
  754. },
  755. loadData(item, callback) {
  756. item.loading = true;
  757. cityApi({
  758. pid: item.value
  759. }).then(res => {
  760. item.children = res.data;
  761. item.loading = false;
  762. callback();
  763. });
  764. },
  765. getGodownList() {
  766. getGodownList().then(res => {
  767. console.log(res);
  768. this.data1 = res.data.data
  769. // .map(item => {
  770. // item.id += ''
  771. // return item
  772. // });
  773. })
  774. },
  775. del(index) {
  776. this.chooseGoods.splice(index, 1);
  777. },
  778. userSearchse(e) {
  779. this.formValidate.create_uid = "";
  780. this.authList = []
  781. this.getUserList()
  782. },
  783. userSearchs(e) {
  784. this.formValidate.wid = 0
  785. this.goods = []
  786. },
  787. userSearchss(e) {
  788. this.formValidate.create_uid = "";
  789. this.formValidate.store_id = 0
  790. this.authList = []
  791. this.getUserList()
  792. },
  793. checkOutWare(e) {
  794. this.formValidate.create_uid = "";
  795. this.authList = []
  796. this.chooseGoods = []
  797. if (e) {
  798. this.getUserList()
  799. }
  800. },
  801. changeOutType(e) {
  802. this.formValidate.wid = 0
  803. this.formValidate.store_id = 0
  804. this.checkOutWare(0)
  805. },
  806. userSearchsss(e) {
  807. if (e) {
  808. let obj = this.authList.find(item => item.id == e)
  809. this.formValidate.create_admin_id = obj.admin_id
  810. }
  811. },
  812. checkWid(e) {
  813. },
  814. handleSubmit(name) {
  815. let that = this
  816. let errIndex = 0
  817. let err1 = 0
  818. this.chooseGoods.forEach(item => {
  819. // if(item)
  820. if (that.type == 1) {
  821. item.group.forEach(e => {
  822. if (e.is_weigh == 1 && e.net_weight == 0) {
  823. errIndex++
  824. }
  825. })
  826. } else {
  827. item.batchs.forEach(e => {
  828. if (e.is_weigh == 1 && e.net_weight == 0) {
  829. errIndex++
  830. }
  831. })
  832. if(!item.bin_number) {
  833. err1++
  834. }
  835. }
  836. })
  837. if (errIndex > 0) {
  838. return this.$Message.error('称重商品需填写净重')
  839. }
  840. if(err1 > 0) {
  841. return this.$Message.error('请选择仓位')
  842. }
  843. console.log(this.chooseGoods, '最后');
  844. this.$refs[name].validate((valid) => {
  845. if (valid) {
  846. try {
  847. let pdata = {
  848. freight: this.formValidate.freight,
  849. info: this.chooseGoods,
  850. out_order_id: this.formValidate.out_order_id,
  851. }
  852. console.log('2');
  853. let pf;
  854. if (that.type == 1) {
  855. pf = storeReceipt
  856. pdata.store_id = that.formValidate.to_store_id
  857. } else {
  858. pf = wareDelivery
  859. pdata.wid = that.formValidate.wid
  860. pdata.create_uid = this.formValidate.create_uid
  861. pdata.create_admin_id = this.formValidate.create_admin_id
  862. }
  863. pf(pdata).then(res => {
  864. this.$Message.success(res.msg);
  865. this.$router.push({
  866. path: this.roterPre + "/erp/out_list"
  867. });
  868. }).catch(err => {
  869. this.$Message.error(err.msg);
  870. })
  871. } catch (e) {
  872. //TODO handle the exception
  873. console.log(e, 'errr');
  874. }
  875. } else {
  876. // this.$Message.error("请输入参数模板名称");
  877. }
  878. });
  879. },
  880. },
  881. };
  882. </script>
  883. <style scoped lang="stylus">
  884. .table {
  885. /deep/.ivu-table-header table {
  886. border: 0 !important;
  887. }
  888. /deep/.ivu-table-header thead tr th:nth-of-type(1) {
  889. padding-left: 16px;
  890. }
  891. /deep/.ivu-table td:nth-of-type(1) {
  892. padding-left: 16px;
  893. }
  894. /deep/.ivu-table-cell {
  895. padding: 0 !important;
  896. }
  897. /deep/.ivu-table-border th,
  898. /deep/.ivu-table-border td {
  899. border-right: unset;
  900. }
  901. /deep/.ivu-table td {
  902. height: 59px;
  903. }
  904. }
  905. .form-submit {
  906. /deep/.ivu-card {
  907. border-radius: 0;
  908. }
  909. margin-bottom: 79px;
  910. .fixed-card {
  911. position: fixed;
  912. right: 0;
  913. bottom: 0;
  914. left: 200px;
  915. z-index: 99;
  916. box-shadow: 0 -1px 2px rgb(240, 240, 240);
  917. /deep/ .ivu-card-body {
  918. padding: 15px 16px 14px;
  919. }
  920. .ivu-form-item {
  921. margin-bottom: 0;
  922. }
  923. /deep/ .ivu-form-item-content {
  924. margin-right: 124px;
  925. text-align: center;
  926. }
  927. .ivu-btn {
  928. height: 36px;
  929. padding: 0 20px;
  930. }
  931. }
  932. }
  933. .after-line {
  934. display: inline-block;
  935. position: relative;
  936. margin-right: 16px;
  937. }
  938. .ml16 {
  939. margin-left: 16px;
  940. }
  941. .user-info {
  942. position: relative;
  943. padding: 20px;
  944. .section {
  945. padding: 25px 25px;
  946. border-bottom: 1px dashed #EEEEEE;
  947. position: relative;
  948. &-hd {
  949. padding-left: 10px;
  950. border-left: 3px solid #1890FF;
  951. font-weight: 500;
  952. font-size: 14px;
  953. line-height: 16px;
  954. color: #303133;
  955. }
  956. &-bd {
  957. display: flex;
  958. flex-wrap: wrap;
  959. }
  960. .item {
  961. // flex: 0 0 calc(~"(100% - 60px) / 3");
  962. width: 25%;
  963. min-width: 250px;
  964. display: flex;
  965. margin: 16px 30px 0 0;
  966. font-size: 13px;
  967. color: #606266;
  968. &:nth-child(3n+3) {
  969. margin: 16px 0 0;
  970. }
  971. }
  972. .value {
  973. flex: 1;
  974. }
  975. .avatar {
  976. width: 60px;
  977. height: 60px;
  978. overflow: hidden;
  979. img {
  980. width: 100%;
  981. height: 100%;
  982. }
  983. }
  984. }
  985. }
  986. .del-btn {
  987. position: absolute;
  988. right: 20px;
  989. top: 10px;
  990. }
  991. .del-btn-1 {
  992. position: absolute;
  993. right: 80px;
  994. bottom: 20px;
  995. }
  996. /deep/ .ivu-modal-content {
  997. // width: 600px;
  998. }
  999. </style>