business-edit.vue 21 KB

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