business-entering.vue 22 KB

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