business-edit.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  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-show="!hs.visible&&!china.visible"></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. }
  304. },
  305. onShow() {
  306. this.customerId = uni.getStorageSync('customerId');
  307. },
  308. onLoad(options) {
  309. this.form.id = options.id;
  310. this.getBusinessPeople();
  311. if (this.customerId == '1') {
  312. this.getCustomerList();
  313. }
  314. this.getGoodsList();
  315. this.getUnit();
  316. let that=this;
  317. uni.$on('getSelectDeclare', declare => {
  318. that.$nextTick(() => {
  319. that.form.declareNo = declare.declareNo;
  320. that.form.cardNo = declare.carNo;
  321. that.form.chinaCarNo = declare.chinaCarNo;
  322. that.form.netWeight = declare.grossWeight;
  323. let chinaCarNo = declare.chinaCarNo;
  324. if (chinaCarNo) {
  325. let list = [];
  326. chinaCarNo.replace(",", ",").split(",").forEach(carNo => {
  327. let obj = {
  328. carNo: carNo
  329. }
  330. list.push(obj);
  331. that.china.list = list;
  332. })
  333. }else{
  334. that.china.list =[];
  335. }
  336. })
  337. })
  338. },
  339. computed: {
  340. totalPrice() {
  341. let itemList = this.itemList.filter(obj => obj.itemName);
  342. let price = 0;
  343. for (let i in itemList) {
  344. let type = itemList[i];
  345. let items = type.items;
  346. for (let j in items) {
  347. let item = items[j];
  348. if (item.itemName == type.itemName) {
  349. price += item.price;
  350. break;
  351. }
  352. }
  353. }
  354. return price;
  355. }
  356. },
  357. created() {
  358. },
  359. methods: {
  360. selectDeclare() {
  361. this.$common.to('/pages/business-entering/declare-select?declareNo=' + this.form.declareNo)
  362. },
  363. addCar() {
  364. this.china.visible = true;
  365. },
  366. showChinaModal() {
  367. Object.assign(this.chinaAddModal, {
  368. visible: true,
  369. index: -1,
  370. form: {
  371. carNo: '',
  372. driverName: '',
  373. driverPhone: ''
  374. }
  375. })
  376. },
  377. sureCarFn() {
  378. let form = this.chinaAddModal.form;
  379. let carNo = form.carNo;
  380. let phone = form.driverPhone;
  381. if (carNo && !this.$common.isCarNo(carNo)) {
  382. this.$common.toast('请输入正确的车牌号')
  383. return;
  384. }
  385. if (phone && !this.$common.isPhone(phone)) {
  386. this.$common.toast('请输入正确的手机号')
  387. return;
  388. }
  389. let list = this.china.list;
  390. let index = this.chinaAddModal.index;
  391. if (index > -1) {
  392. list.splice(index, 1)
  393. }
  394. list.push(form)
  395. this.chinaAddModal.visible = false;
  396. },
  397. deleteChinaCar(item, index) {
  398. this.china.list.splice(index, 1);
  399. },
  400. editChinaCar(item, index) {
  401. Object.assign(this.chinaAddModal, {
  402. visible: true,
  403. index: index,
  404. form: item
  405. })
  406. },
  407. getBusinessById() {
  408. this.$api.getBusinessById({
  409. id: this.form.id
  410. }).then(resp => {
  411. let data = resp.data;
  412. this.form = data;
  413. let list=this.chinaCarPrefix;
  414. this.china.list=data.cars.filter(obj=>{
  415. return list.indexOf(obj.carNo.substr(0,1))!==-1
  416. });
  417. console.log(this.china.list)
  418. let goodsName = data.goodsName;
  419. this.customer.index = this.customer.customerList.map(obj => obj.name).indexOf(data
  420. .customerName);
  421. this.goods.index = this.goods.goodsList.map(o => o.name).indexOf(goodsName);
  422. let goods = this.goods.goodsList[this.goods.index];
  423. let items = data.items;
  424. let noNeedIds = goods.noNeedIds.split(',');
  425. let itemTypeList = this.itemList.filter(obj => noNeedIds.indexOf(obj.id) == -1);
  426. this.filterItemList = itemTypeList;
  427. for (let i in itemTypeList) {
  428. let type = itemTypeList[i];
  429. for (let j in items) {
  430. let item = items[j];
  431. if (item.itemTypeId == type.id) {
  432. type.itemName = item.itemName;
  433. let typeName=type.name;
  434. if (typeName == '干杂货人工装卸' || typeName == '特殊车辆') {
  435. this.checkItem = typeName;
  436. }
  437. type.num = item.num
  438. break;
  439. }
  440. }
  441. }
  442. setTimeout(() => {
  443. this.car.carInput = false;
  444. }, 30)
  445. })
  446. },
  447. getBusinessPeople() {
  448. this.$api.getBusinessPeople({
  449. businessId: this.form.id
  450. }).then(resp => {
  451. let list = resp.data;
  452. let index = 0;
  453. let r = [];
  454. for (let i in list) {
  455. r.push({
  456. name: list[i].name,
  457. phone: list[i].phone,
  458. index: index,
  459. id: list[i].id
  460. })
  461. index++;
  462. }
  463. this.hs.list = r;
  464. })
  465. },
  466. whChange(event) {
  467. let index = event.detail.value; //当前picker选中的值
  468. this.goods.index = index;
  469. let goods = this.goods.goodsList[index];
  470. let noNeedIds = goods.noNeedIds.split(',');
  471. this.needTypeId = goods.needIds.split(',')
  472. this.filterItemList = this.itemList.filter(obj => noNeedIds.indexOf(obj.id) == -1);
  473. },
  474. carSizeInput() {
  475. let carSize = this.form.cardSize;
  476. let filterUnitList = this.unitList.filter(obj => obj.unit.indexOf(carSize) !== -1);
  477. this.car.carInput = filterUnitList.length > 0;
  478. this.filterUnitList = filterUnitList;
  479. },
  480. getUnit() {
  481. this.$api.getUnitList().then(resp => {
  482. this.unitList = resp.data;
  483. })
  484. },
  485. selectCarSize(data) {
  486. this.form.cardSize = data.unit;
  487. this.car.carInput = false;
  488. },
  489. expectDayChange(date) {
  490. this.form.expectInDay = date;
  491. },
  492. addHsFn(num, show) {
  493. this.hs.num = num;
  494. this.hs.visible = show;
  495. },
  496. showHsModal() {
  497. Object.assign(this.modal, {
  498. visible: true,
  499. form: {
  500. name: '',
  501. phone: '',
  502. index: -1
  503. }
  504. });
  505. },
  506. addHsPeopleFn() {
  507. if (!this.modal.form.name) {
  508. this.$common.toast('请输入名称');
  509. return;
  510. }
  511. if (this.modal.form.phone && !this.$common.isPhone(this.modal.form.phone)) {
  512. this.$common.toast('联系号码不正确');
  513. return;
  514. }
  515. let dbIndex = this.modal.form.index;
  516. if (dbIndex >= 0) {
  517. this.hs.list[dbIndex].name = this.modal.form.name;
  518. this.hs.list[dbIndex].phone = this.modal.form.phone;
  519. } else {
  520. this.modal.form.index = this.hs.list.length;
  521. this.hs.list.push(this.modal.form);
  522. }
  523. this.modal.visible = false;
  524. },
  525. editFn(data) {
  526. Object.assign(this.modal, {
  527. visible: true,
  528. form: data
  529. })
  530. },
  531. deleteFn(data) {
  532. this.hs.list.splice(data.index, 1);
  533. if (data.id) {
  534. this.$api.deleteHsPeople({
  535. id: data.id
  536. });
  537. }
  538. },
  539. getGoodsList() {
  540. this.$api.getGoodsList().then(resp => {
  541. this.goods.goodsList = resp.data;
  542. this.getItemList();
  543. })
  544. },
  545. getItemList() {
  546. this.$api.getItemList().then(resp => {
  547. this.itemList = resp.data;
  548. this.getBusinessById();
  549. })
  550. },
  551. handlerTypeItem(goods) {
  552. },
  553. idCardInput() {
  554. let val = this.form.driverIdCard;
  555. let list = this.driverList.filter(obj => obj.idCard.indexOf(val) !== -1);
  556. if (list.length > 0 && val) {
  557. this.driver.show = true;
  558. this.driver.filterList = list;
  559. } else {
  560. this.driver.show = false;
  561. }
  562. },
  563. selectDriverFn(item) {
  564. this.form.driverIdCard = item.idCard;
  565. this.form.driverName = item.name;
  566. this.form.driverPhone = item.phone
  567. let that = this;
  568. setTimeout(() => {
  569. that.driver.show = false;
  570. }, 150)
  571. },
  572. selectCarNo(item) {
  573. this.form.cardNo = item.cardNo;
  574. this.form.cardSize = item.cardSize;
  575. this.form.netWeight = item.lastNetWeight;
  576. let names = this.goods.goodsList.map(obj => obj.name);
  577. let index = names.indexOf(item.lastGoodsName);
  578. this.goods.index = index == -1 ? 0 : index;
  579. this.country.index = this.country.list.indexOf(item.countryName)
  580. let that = this;
  581. setTimeout(() => {
  582. this.car.carInput = false;
  583. }, 150)
  584. },
  585. getCustomerList() {
  586. this.$api.getCustomerList().then(resp => {
  587. this.customer.customerList = resp.data;
  588. })
  589. },
  590. selectItemFn(item) {
  591. let typeName = item.name;
  592. let checkItem = this.checkItem;
  593. if ((typeName == '干杂货人工装卸' && checkItem == '特殊车辆') ||
  594. (typeName == '特殊车辆' && checkItem == '干杂货人工装卸')) {
  595. this.$common.toast('不能同时选择干杂货人工装卸和特殊车辆');
  596. return false;
  597. }
  598. if (typeName == '干杂货人工装卸' || typeName == '特殊车辆') {
  599. this.checkItem = typeName;
  600. }
  601. this.item = item;
  602. this.show = true;
  603. },
  604. cleanItemSelect(item) {
  605. item.itemName = '';
  606. setTimeout(() => {
  607. this.show = false;
  608. this.checkItem = ''
  609. }, 80)
  610. },
  611. itemSelectFn(data) {
  612. this.show = false;
  613. this.item.itemName = data;
  614. },
  615. check() {
  616. if (!this.form.cardNo) {
  617. this.$common.toast('请录入境外车牌号')
  618. return false;
  619. }
  620. if (!this.$common.isNum(this.form.cardSize)) {
  621. this.$common.toast('车辆规格请录入数字')
  622. return false;
  623. }
  624. if (!this.form.netWeight || !this.$common.isNum(this.form.netWeight)) {
  625. this.$common.toast('载重必须输入数字')
  626. return false;
  627. }
  628. let typeList = this.filterItemList.filter(obj => obj.itemName);
  629. if (typeList.length == 0) {
  630. this.$common.toast('至少选择一项业务项')
  631. return false;
  632. }
  633. let filterItemList = this.filterItemList;
  634. for (let j in this.needTypeId) {
  635. let id = this.needTypeId[j];
  636. for (let i in filterItemList) {
  637. let type = filterItemList[i];
  638. if (id == type.id && !type.itemName) {
  639. this.$common.toast('[' + type.name + ']必选')
  640. return;
  641. }
  642. }
  643. }
  644. let peopleList = this.hs.list;
  645. if (typeList.filter(obj => obj.name.indexOf('人') !== -1 &&
  646. obj.name.indexOf('核酸') !== -1).length > 0 &&
  647. peopleList.length == 0) {
  648. this.$common.toast('录入核酸检测人员')
  649. return false;
  650. }
  651. let list = [];
  652. for (let i in typeList) {
  653. let type = typeList[i];
  654. type.num = 1;
  655. for (let j in type.items) {
  656. let item = type.items[j];
  657. if (type.itemName == item.itemName) {
  658. type.itemId = item.id;
  659. break;
  660. }
  661. }
  662. list.push({
  663. itemId: type.itemId,
  664. num: type.num
  665. })
  666. }
  667. this.form.itemJson = JSON.stringify(list);
  668. this.form.peopleJson = JSON.stringify(peopleList);
  669. this.form.carJson=JSON.stringify(this.china.list);
  670. this.form.items = null;
  671. this.form.cars=null;
  672. if (this.customerId == '1') {
  673. this.form.customerId = this.customer.customerList[this.customer.index].id;
  674. } else {
  675. this.form.customerId = this.customerId;
  676. }
  677. this.form.goodsName = this.goods.goodsList[this.goods.index].name;
  678. return true;
  679. },
  680. saveFn() {
  681. if (this.check()) {
  682. let obj = this.$common.removeNull(this.form);
  683. this.$api.saveBusiness(obj).then(resp => {
  684. if (resp.code == 200) {
  685. uni.removeStorageSync('business_' + this.customerId);
  686. this.$common.toast('修改成功');
  687. this.hs.list = [];
  688. setTimeout(() => {
  689. this.$common.to('/pages/business-order/business-order')
  690. }, 1000)
  691. }
  692. })
  693. }
  694. },
  695. bindPickerChange(e) {
  696. var nowId = e.target.id; //当前picker的ID id需要自己设置 在picker中
  697. var value = e.detail.value; //当前picker选中的值
  698. switch (nowId) { //根据ID判断是哪个picker
  699. case "qy": //picker的ID
  700. this.customer.index = value;
  701. break;
  702. case "hw": //picker的ID
  703. this.goods.index = value;
  704. break;
  705. case "gj": //picker的ID
  706. this.country.index = value;
  707. break;
  708. }
  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>