business-entering.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  1. <template>
  2. <view>
  3. <view class="box" v-show="hs.visible">
  4. <view class="top">
  5. <text class="title">录入核酸人员</text>
  6. </view>
  7. <view style="display: flex;margin-top: 40rpx;">
  8. <u-button type="primary" @click="hs.visible=false" text="返回" style="width: 20px;" size="mini" />
  9. <u-button type="primary" @click="showHsModal" text="添加" v-show="hs.num>hs.list.length" icon="plus"
  10. style="width: 20px;" size="mini" />
  11. </view>
  12. <u-row style="margin-top: 70rpx;">
  13. <u-col span="4" style="text-align: center;">姓名</u-col>
  14. <u-col span="4" style="text-align: center;">联系号码</u-col>
  15. <u-col span="4" style="text-align: center;">操作</u-col>
  16. </u-row>
  17. <u-row v-for="item in hs.list" style="margin-top: 40rpx;">
  18. <u-col span="4" style="text-align: center;">{{item.name}}</u-col>
  19. <u-col span="4" style="text-align: center;">{{item.phone}}</u-col>
  20. <u-col span="4" style="text-align: center;">
  21. <u-row>
  22. <u-col span="6">
  23. <u-button type="primary" text="编辑" style="width: 20px;" @click="editFn(item)" size="mini">
  24. </u-button>
  25. </u-col>
  26. <u-col span="6">
  27. <u-button type="error" style="width: 20px;" text="删除" @click="deleteFn(item)" size="mini">
  28. </u-button>
  29. </u-col>
  30. </u-row>
  31. </u-col>
  32. </u-row>
  33. </view>
  34. <view class="box" v-show="china.visible">
  35. <view class="top">
  36. <text class="title">中国车录入</text>
  37. </view>
  38. <view style="display: flex;margin-top: 40rpx;">
  39. <u-button type="primary" @click="china.visible=false" text="返回" style="width: 20px;" size="mini" />
  40. <u-button type="primary" @click="showChinaModal" text="添加" icon="plus" style="width: 20px;"
  41. size="mini" />
  42. </view>
  43. <u-row style="margin-top: 70rpx;">
  44. <u-col span="3" style="text-align: center;">车牌号</u-col>
  45. <u-col span="3" style="text-align: center;">联系人</u-col>
  46. <u-col span="3" style="text-align: center;">联系号码</u-col>
  47. <u-col span="3" style="text-align: center;">操作</u-col>
  48. </u-row>
  49. <u-row v-for="(item,index) in china.list" style="margin-top: 40rpx;">
  50. <u-col span="3" style="text-align: center;">{{item.carNo}}</u-col>
  51. <u-col span="3" style="text-align: center;">{{item.driverName}}</u-col>
  52. <u-col span="3" style="text-align: center;">{{item.driverPhone}}</u-col>
  53. <u-col span="3" style="text-align: center;">
  54. <u-row>
  55. <u-col span="6">
  56. <u-button type="primary" text="编辑" style="width: 20px;" @click="editChinaCar(item,index)"
  57. size="mini">
  58. </u-button>
  59. </u-col>
  60. <u-col span="6">
  61. <u-button type="error" style="width: 20px;" text="删除" @click="deleteChinaCar(item,index)"
  62. size="mini">
  63. </u-button>
  64. </u-col>
  65. </u-row>
  66. </u-col>
  67. </u-row>
  68. </view>
  69. <view class="box" v-show="!hs.visible&&!china.visible">
  70. <view class="top">
  71. <text class="title">整车录入</text>
  72. </view>
  73. <view class="item">
  74. <view class="l"><text style="color: red;">*</text>申报单号:</view>
  75. <view class="r">
  76. <u-input placeholder="申报订单号" v-model="form.declareNo" clearable readonly>
  77. <text slot="suffix" style="font-size: 50rpx;" @click="selectDeclare">+</text>
  78. </u-input>
  79. </view>
  80. </view>
  81. <view class="item">
  82. <view class="l">申报单位:</view>
  83. <view class="r">
  84. <u-input placeholder="申报单位" disabled @input="handler()" v-model="form.customerName">
  85. </u-input>
  86. </view>
  87. </view>
  88. <view class="item">
  89. <view class="l"><text style="color: red;">*</text>货物:</view>
  90. <view class="r">
  91. <picker v-if="goods.goodsList.length>0" class="p-picker" id="hw" @change="whChange($event)"
  92. :value="goods.index" :range="goods.goodsList" range-key="name">
  93. <text class="p-text">{{goods.goodsList[goods.index].name}}</text>
  94. <u-icon class="p-icon" name="arrow-down-fill" size="20"></u-icon>
  95. </picker>
  96. </view>
  97. </view>
  98. <view class="item">
  99. <view class="l"><text style="color: red;">*</text>载重:</view>
  100. <view class="r">
  101. <u-input type="number" placeholder="输入载重" @input="handler()" v-model="form.netWeight">
  102. <text slot="suffix">吨</text>
  103. </u-input>
  104. </view>
  105. </view>
  106. <view class="item">
  107. <view class="l"><text style="color: red;">*</text>境外车牌:</view>
  108. <view class="r">
  109. <u-input placeholder="输入车牌号" @input="handler()" v-model="form.cardNo" />
  110. </view>
  111. </view>
  112. <view class="item">
  113. <view class="l"><text style="color: red;">*</text>境外车规格:</view>
  114. <view class="r">
  115. <u-input type="number" placeholder="输入车辆规格" @input="handler()" v-model="form.cardSize">
  116. <text slot="suffix">米</text>
  117. </u-input>
  118. </view>
  119. </view>
  120. <view class="item">
  121. <view class="l">中国车:</view>
  122. <view class="r">
  123. <u-input placeholder="中国车" v-model="china.list.map(obj=>obj.carNo).join('、')" readonly>
  124. <text slot="suffix" style="font-size: 50rpx;" @click="addCar">+</text>
  125. </u-input>
  126. </view>
  127. </view>
  128. <view class="item-line">
  129. 业务项
  130. </view>
  131. <view class="item" v-for="item in filterItemList" :key="item.id" v-if="item.items.length>0">
  132. <view class="l"><text v-if="needTypeId.indexOf(item.id)!==-1" style="color: red;">*</text>{{item.name}}:
  133. </view>
  134. <view class="r">
  135. <view @click="selectItemFn(item)">
  136. <u-input placeholder="请选择" v-model="item.itemName" readonly clearable style="width: 120px;">
  137. <u-icon name="close" v-if="item.itemName" slot="suffix" color="#E5E5E5;" size="5"
  138. @click="cleanItemSelect(item)"></u-icon>
  139. </u-input>
  140. </view>
  141. <u-input placeholder="数量" :disabled="item.inc==0" border="surround" v-model="item.num" type="number"
  142. style="width: 10px;" v-if="item.itemName"></u-input>
  143. <view style="margin-left: 20rpx;color: red;" v-if="item.itemName">
  144. {{item.items.filter(obj=>obj.itemName==item.itemName)[0].price*item.num}}元
  145. </view>
  146. <u-icon name="plus" style="position: absolute;right: 10rpx;"
  147. v-if="item.itemName&&item.name.indexOf('人')!==-1&&item.name.indexOf('核酸')!==-1"
  148. @click="addHsFn(item.itemName,item.num)"></u-icon>
  149. </view>
  150. </view>
  151. <view class="hj" v-show="totalPrice>0">
  152. 合计:{{totalPrice}}元
  153. </view>
  154. </view>
  155. <u-button type="primary" text="确定" @click="saveFn" v-show="(!hs.visible&&!china.visible)&&perList.indexOf('tb-business-add')!==-1"></u-button>
  156. <!-- ---------------------------------------------------------- -->
  157. <view class="bottom-safety"></view>
  158. <u-popup :show="car.carInput" :overlay="false" @close="car.carInput=false" borderRadius="10">
  159. <view style="padding: 40rpx;line-height: 60rpx;text-align: center;">
  160. <view v-for="item in filterUnitList" :id="item.id"
  161. style="margin-bottom: 20rpx;border-bottom: 1rpx solid #E5E5E5;" @click="selectCarSize(item)">
  162. {{item.unit}}
  163. </view>
  164. </view>
  165. </u-popup>
  166. <u-popup :show="driver.show" :overlay="false" @close="driver.show=false" borderRadius="10">
  167. <view style="padding: 40rpx;line-height: 60rpx;text-align: center;">
  168. <view v-for="item in driver.filterList" :id="item.id"
  169. style="margin-bottom: 20rpx;border-bottom: 1rpx solid #E5E5E5;" @click="selectDriverFn(item)">
  170. {{item.name}}({{item.idCard}})
  171. </view>
  172. </view>
  173. </u-popup>
  174. <u-popup :show="show" closeable closeOnClickOverlay @close="show=false">
  175. <view style="padding: 40rpx;">
  176. <u-radio-group @change="itemSelectFn" placement="column" v-model="item.itemName">
  177. <u-radio v-for="item in item.items" :key="item.id" :label="item.itemName" :name="item.itemName"
  178. v-if="form.netWeight >= item.minWeight
  179. && form.netWeight < item.maxWeight
  180. &&form.cardSize<=item.carLength
  181. &&form.cardSize>=item.minLength" style="margin-top: 30rpx;">
  182. </u-radio>
  183. </u-radio-group>
  184. </view>
  185. </u-popup>
  186. <u-modal :show="modal.visible" showCancelButton closeOnClickOverlay @cancel="modal.visible=false"
  187. @confirm="addHsPeopleFn">
  188. <view style="">
  189. <u--input placeholder="姓名" border="surround" v-model="modal.form.name"></u--input>
  190. <u--input style="margin-top: 20rpx;" placeholder="联系号码" border="surround" v-model="modal.form.phone">
  191. </u--input>
  192. </view>
  193. </u-modal>
  194. <u-modal :show="chinaAddModal.visible" title="中国车" @confirm="sureCarFn" @cancel="chinaAddModal.visible=false"
  195. showCancelButton cancelText="关闭">
  196. <view class="slot-content">
  197. <u-row>
  198. <u-col span="4">车牌号</u-col>
  199. <u-col span="8">
  200. <u--input placeholder="车牌号" v-model="chinaAddModal.form.carNo"></u--input>
  201. </u-col>
  202. </u-row>
  203. <u-row>
  204. <u-col span="4">联系人</u-col>
  205. <u-col span="8">
  206. <u--input placeholder="联系人" v-model="chinaAddModal.form.driverName"></u--input>
  207. </u-col>
  208. </u-row>
  209. <u-row>
  210. <u-col span="4">联系号码</u-col>
  211. <u-col span="8">
  212. <u--input placeholder="联系号码" v-model="chinaAddModal.form.driverPhone"></u--input>
  213. </u-col>
  214. </u-row>
  215. </view>
  216. </u-modal>
  217. </view>
  218. </template>
  219. <script>
  220. export default {
  221. data() {
  222. return {
  223. car: {
  224. carInput: false,
  225. filterList: [],
  226. },
  227. driver: {
  228. show: false,
  229. filterList: [],
  230. },
  231. customerId: '1',
  232. exprctStart: new Date().getTime(),
  233. itemList: [],
  234. filterItemList: [],
  235. needTypeId: [],
  236. noNeedIds: [],
  237. form: {
  238. customerId: '',
  239. customerIndex: 0,
  240. declareNo: '',
  241. countryIndex: 0,
  242. goodsIndex: 0,
  243. cardNo: '',
  244. cardSize: '',
  245. goodsName: '',
  246. netWeight: '',
  247. driverName: '',
  248. driverPhone: '',
  249. expectInDay: ''
  250. },
  251. show: false,
  252. item: {
  253. items: []
  254. },
  255. customer: {
  256. index: 0,
  257. customerList: [],
  258. },
  259. carList: [],
  260. driverList: [],
  261. unitList: [],
  262. filterUnitList: [],
  263. country: {
  264. index: 0,
  265. list: ['越南车', '中国车']
  266. },
  267. goods: {
  268. index: 0,
  269. goodsList: []
  270. },
  271. hs: {
  272. visible: false,
  273. num: 1,
  274. list: []
  275. },
  276. modal: {
  277. visible: false,
  278. form: {
  279. name: '',
  280. phone: ''
  281. }
  282. },
  283. china: {
  284. visible: false,
  285. index: -1,
  286. list: []
  287. },
  288. chinaAddModal: {
  289. visible: false,
  290. form: {
  291. carNo: '',
  292. driverName: '',
  293. driverPhone: ''
  294. }
  295. },
  296. checkItem: '',
  297. perList:[]
  298. }
  299. },
  300. onShow() {
  301. this.customerId = uni.getStorageSync('customerId');
  302. this.perList=uni.getStorageSync('perList')
  303. },
  304. computed: {
  305. totalPrice() {
  306. let itemList = this.itemList.filter(obj => obj.itemName);
  307. let price = 0;
  308. for (let i in itemList) {
  309. let type = itemList[i];
  310. let items = type.items;
  311. for (let j in items) {
  312. let item = items[j];
  313. if (item.itemName == type.itemName) {
  314. price += item.price;
  315. break;
  316. }
  317. }
  318. }
  319. return price;
  320. },
  321. },
  322. created() {
  323. this.getGoodsList();
  324. this.getUnit();
  325. },
  326. onLoad(options) {
  327. let that = this;
  328. uni.$on('getSelectDeclare', declare => {
  329. that.$nextTick(() => {
  330. that.form.declareNo = declare.declareNo;
  331. that.form.cardNo = declare.carNo;
  332. that.form.chinaCarNo = declare.chinaCarNo;
  333. that.form.netWeight = declare.grossWeight;
  334. that.form.customerId=declare.customerId;
  335. that.form.customerName=declare.customerName;
  336. let chinaCarNo = declare.chinaCarNo;
  337. if (chinaCarNo) {
  338. let list = [];
  339. chinaCarNo.replace(",", ",").split(",").forEach(carNo => {
  340. let obj = {
  341. carNo: carNo
  342. }
  343. list.push(obj);
  344. that.china.list = list;
  345. })
  346. }else{
  347. that.china.list =[];
  348. }
  349. that.handler();
  350. })
  351. })
  352. },
  353. methods: {
  354. selectDeclare() {
  355. this.$common.to('/pages/business-entering/declare-select?declareNo=' + this.form.declareNo)
  356. },
  357. addCar() {
  358. this.china.visible = true;
  359. },
  360. showChinaModal() {
  361. Object.assign(this.chinaAddModal, {
  362. visible: true,
  363. index: -1,
  364. form: {
  365. carNo: '',
  366. driverName: '',
  367. driverPhone: ''
  368. }
  369. })
  370. },
  371. sureCarFn() {
  372. let form = this.chinaAddModal.form;
  373. let carNo = form.carNo;
  374. let phone = form.driverPhone;
  375. if (carNo && !this.$common.isCarNo(carNo)) {
  376. this.$common.toast('请输入正确的车牌号')
  377. return;
  378. }
  379. if (phone && !this.$common.isPhone(phone)) {
  380. this.$common.toast('请输入正确的手机号')
  381. return;
  382. }
  383. let list = this.china.list;
  384. let index = this.chinaAddModal.index;
  385. if (index > -1) {
  386. list.splice(index, 1)
  387. }
  388. list.push(form)
  389. this.chinaAddModal.visible = false;
  390. },
  391. deleteChinaCar(item, index) {
  392. this.china.list.splice(index, 1);
  393. },
  394. editChinaCar(item, index) {
  395. Object.assign(this.chinaAddModal, {
  396. visible: true,
  397. index: index,
  398. form: item
  399. })
  400. },
  401. whChange(event) {
  402. let index = event.detail.value; //当前picker选中的值
  403. this.goods.index = index;
  404. let goods = this.goods.goodsList[index];
  405. let noNeedIds = goods.noNeedIds.split(',');
  406. this.needTypeId = goods.needIds.split(',');
  407. this.noNeedIds = goods.noNeedIds.split(',')
  408. this.filterItemList = this.itemList.filter(obj => noNeedIds.indexOf(obj.id) == -1);
  409. this.handler();
  410. },
  411. carSizeInput() {
  412. let carSize = this.form.cardSize;
  413. let filterUnitList = this.unitList.filter(obj => obj.unit.indexOf(carSize) !== -1);
  414. this.car.carInput = filterUnitList.length > 0;
  415. this.filterUnitList = filterUnitList;
  416. this.handler();
  417. },
  418. getUnit() {
  419. this.$api.getUnitList().then(resp => {
  420. this.unitList = resp.data;
  421. })
  422. },
  423. selectCarSize(data) {
  424. this.form.cardSize = data.unit;
  425. this.car.carInput = false;
  426. this.handler();
  427. },
  428. expectDayChange(date) {
  429. this.form.expectInDay = date;
  430. this.handler();
  431. },
  432. addHsFn(itemName, num) {
  433. this.hs.visible = true;
  434. this.hs.num = num;
  435. },
  436. showHsModal() {
  437. Object.assign(this.modal, {
  438. visible: true,
  439. form: {
  440. name: '',
  441. phone: '',
  442. index: -1
  443. }
  444. });
  445. },
  446. addHsPeopleFn() {
  447. if (!this.modal.form.name) {
  448. this.$common.toast('请输入名称');
  449. return;
  450. }
  451. if (this.modal.form.phone && !this.$common.isPhone(this.modal.form.phone)) {
  452. this.$common.toast('联系号码不正确');
  453. return;
  454. }
  455. let dbIndex = this.modal.form.index;
  456. if (dbIndex >= 0) {
  457. this.hs.list[dbIndex].name = this.modal.form.name;
  458. this.hs.list[dbIndex].phone = this.modal.form.phone;
  459. } else {
  460. this.modal.form.index = this.hs.list.length;
  461. this.hs.list.push(this.modal.form);
  462. }
  463. this.modal.visible = false;
  464. this.handler();
  465. },
  466. editFn(data) {
  467. Object.assign(this.modal, {
  468. visible: true,
  469. form: data
  470. })
  471. },
  472. deleteFn(data) {
  473. this.hs.list.splice(data.index, 1);
  474. if (data.id) {
  475. this.$api.deleteHsPeople({
  476. id: data.id
  477. });
  478. }
  479. },
  480. getGoodsList() {
  481. this.$api.getGoodsList().then(resp => {
  482. this.goods.goodsList = resp.data;
  483. let goods = resp.data[0];
  484. let noNeedIds = goods.noNeedIds.split(',');
  485. this.needTypeId = goods.needIds.split(',')
  486. this.noNeedIds = goods.noNeedIds.split(',')
  487. this.$api.getItemList({business:1}).then(resp => {
  488. let list = resp.data;
  489. this.itemList = list;
  490. this.filterItemList = list.filter(obj => noNeedIds.indexOf(obj.id) == -1);
  491. this.checkStore();
  492. })
  493. })
  494. },
  495. handlerTypeItem(goods) {
  496. },
  497. idCardInput() {
  498. let val = this.form.driverIdCard;
  499. let list = this.driverList.filter(obj => obj.idCard.indexOf(val) !== -1);
  500. if (list.length > 0 && val) {
  501. this.driver.show = true;
  502. this.driver.filterList = list;
  503. } else {
  504. this.driver.show = false;
  505. }
  506. },
  507. selectDriverFn(item) {
  508. this.form.driverIdCard = item.idCard;
  509. this.form.driverName = item.name;
  510. this.form.driverPhone = item.phone
  511. let that = this;
  512. setTimeout(() => {
  513. that.driver.show = false;
  514. }, 150)
  515. },
  516. carInputFn() {
  517. this.handler();
  518. },
  519. selectCarNo(item) {
  520. this.form.cardNo = item.cardNo;
  521. this.form.cardSize = item.cardSize;
  522. this.form.netWeight = item.lastNetWeight;
  523. let names = this.goods.goodsList.map(obj => obj.name);
  524. let index = names.indexOf(item.lastGoodsName);
  525. this.goods.index = index == -1 ? 0 : index;
  526. this.country.index = this.country.list.indexOf(item.countryName)
  527. let that = this;
  528. this.handler();
  529. setTimeout(() => {
  530. this.car.carInput = false;
  531. }, 150)
  532. },
  533. selectItemFn(item) {
  534. this.item = item;
  535. this.show = true;
  536. },
  537. cleanItemSelect(item) {
  538. item.itemName = '';
  539. setTimeout(() => {
  540. this.show = false;
  541. this.checkItem = ''
  542. }, 80)
  543. },
  544. itemSelectFn(data) {
  545. this.show = false;
  546. this.item.itemName = data;
  547. this.handler();
  548. },
  549. handler() {
  550. let goodsIndex = this.goods.index;
  551. let countryIndex = this.country.index;
  552. this.form.goodsName = this.goods.goodsList[goodsIndex].name;
  553. this.form.countryName = this.country.list[countryIndex];
  554. this.form.goodsIndex = goodsIndex;
  555. this.form.countryIndex = countryIndex;
  556. this.form.peopleJson = JSON.stringify(this.hs.list);
  557. this.form.carJson = JSON.stringify(this.china.list);
  558. let customerId = this.customerId;
  559. let inputItem = this.filterItemList
  560. .filter(obj => obj.itemName).map(o => {
  561. return {
  562. typeId: o.id,
  563. itemName: o.itemName,
  564. num: o.num
  565. }
  566. });
  567. this.form.inputItemJson = JSON.stringify(inputItem);
  568. let that = this;
  569. uni.setStorage({
  570. key: 'business_' + customerId,
  571. data: that.form
  572. })
  573. },
  574. checkStore() {
  575. let customerId = this.customerId;
  576. let data = uni.getStorageSync('business_' + customerId)
  577. if (data) {
  578. let that = this;
  579. uni.showModal({
  580. title: '提示',
  581. content: '您上次录入数据未提交,是否继续?',
  582. cancelText: '重新录入',
  583. confirmText: '继续',
  584. success(res) {
  585. if (res.confirm) {
  586. that.rebackStore(data);
  587. } else {
  588. uni.removeStorageSync('business_' + customerId)
  589. }
  590. }
  591. })
  592. }
  593. },
  594. rebackStore(data) {
  595. this.form = data;
  596. this.goods.index = data.goodsIndex ? data.goodsIndex : 0;
  597. this.hs.list = data.peopleJson ? JSON.parse(data.peopleJson) : [];
  598. this.china.list = data.carJson ? JSON.parse(data.carJson) : [];
  599. if (data.inputItemJson) {
  600. let inputItemList = JSON.parse(data.inputItemJson);
  601. let filterList = this.filterItemList;
  602. for (let i in filterList) {
  603. let type = filterList[i];
  604. for (let j in inputItemList) {
  605. let s = inputItemList[j];
  606. if (type.id == s.typeId) {
  607. type.itemName = s.itemName;
  608. type.num = s.num;
  609. break;
  610. }
  611. }
  612. }
  613. }
  614. setTimeout(() => {
  615. this.car.carInput = false;
  616. }, 100)
  617. },
  618. check() {
  619. this.handler();
  620. if (!this.form.cardNo) {
  621. this.$common.toast('请录入境外车牌号')
  622. return false;
  623. }
  624. if (!this.$common.isNum(this.form.cardSize)) {
  625. this.$common.toast('车辆规格请录入数字')
  626. return false;
  627. }
  628. if (!this.form.netWeight || !this.$common.isNum(this.form.netWeight)) {
  629. this.$common.toast('载重必须输入数字')
  630. return false;
  631. }
  632. let typeList = this.filterItemList.filter(obj => obj.itemName);
  633. if (typeList.length == 0) {
  634. this.$common.toast('至少选择一项业务项')
  635. return false;
  636. }
  637. let noNeedIds = this.noNeedIds;
  638. let needIds=this.needTypeId;
  639. for(let i in needIds){
  640. if(typeList.map(obj=>obj.id).indexOf(needIds[i])==-1){
  641. this.$common.toast('缺少必选业务');
  642. return false;
  643. }
  644. }
  645. let peopleList = this.hs.list;
  646. if (typeList.filter(obj => obj.name.indexOf('人') !== -1 &&
  647. obj.name.indexOf('核酸') !== -1).length > 0 &&
  648. peopleList.length == 0) {
  649. this.$common.toast('录入核酸检测人员')
  650. return false;
  651. }
  652. let list = [];
  653. for (let i in typeList) {
  654. let type = typeList[i];
  655. type.num = 1;
  656. for (let j in type.items) {
  657. let item = type.items[j];
  658. if (type.itemName == item.itemName) {
  659. type.itemId = item.id;
  660. break;
  661. }
  662. }
  663. list.push({
  664. itemId: type.itemId,
  665. num: type.num
  666. })
  667. }
  668. this.form.itemJson = JSON.stringify(list);
  669. this.form.peopleJson = JSON.stringify(peopleList);
  670. this.form.carJson = JSON.stringify(this.china.list);
  671. this.form.items = null;
  672. if (this.customerId == '1') {
  673. } else {
  674. this.form.customerId = this.customerId;
  675. }
  676. this.form.goodsName = this.goods.goodsList[this.goods.index].name;
  677. return true;
  678. },
  679. saveFn() {
  680. if (this.check()) {
  681. let obj = this.$common.removeNull(this.form);
  682. this.$api.saveBusiness(obj).then(resp => {
  683. if (resp.code == 200) {
  684. uni.removeStorageSync('business_' + this.customerId);
  685. this.$common.toast('录入成功');
  686. this.hs.list = [];
  687. setTimeout(() => {
  688. this.$common.to('/pages/business-order/business-order')
  689. }, 1000)
  690. }
  691. })
  692. }
  693. },
  694. bindPickerChange(e) {
  695. var nowId = e.target.id; //当前picker的ID id需要自己设置 在picker中
  696. var value = e.detail.value; //当前picker选中的值
  697. switch (nowId) { //根据ID判断是哪个picker
  698. case "qy": //picker的ID
  699. this.customer.index = value;
  700. break;
  701. case "hw": //picker的ID
  702. this.goods.index = value;
  703. break;
  704. case "gj": //picker的ID
  705. this.country.index = value;
  706. break;
  707. }
  708. this.handler();
  709. },
  710. }
  711. }
  712. </script>
  713. <style lang="scss">
  714. page {
  715. background-color: #fff;
  716. }
  717. .hs-item {
  718. text-align: center;
  719. }
  720. .item-line {
  721. color: #a2a2a2;
  722. padding: 5px 0 10px 29px;
  723. border-bottom: 1px solid #E5E5E5;
  724. }
  725. .hj {
  726. padding: 50rpx;
  727. font-size: 40rpx;
  728. color: red;
  729. font-weight: bold;
  730. }
  731. .save-btn {
  732. background-color: #ff4200;
  733. height: 88rpx;
  734. display: flex;
  735. justify-content: center;
  736. align-items: center;
  737. margin: 60rpx;
  738. color: #fff;
  739. font-size: 30rpx;
  740. font-weight: bold;
  741. border-radius: 10rpx;
  742. }
  743. @import '@/common/common.scss'
  744. </style>