business-edit.vue 22 KB

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