business-entering.vue 22 KB

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