business-edit.vue 22 KB

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