business-entering.vue 24 KB

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