business-edit.vue 24 KB

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