tb-car-disincle-edit.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>入境登记-添加/修改</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  8. <!-- 所有的 css js 资源 -->
  9. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  10. <link rel="stylesheet" href="../../static/sa.css">
  11. <script src="../../static/kj/vue.min.js"></script>
  12. <script src="../../static/kj/element-ui/index.js"></script>
  13. <script src="../../static/kj/httpVueLoader.js"></script>
  14. <script src="../../static/kj/jquery.min.js"></script>
  15. <script src="../../static/kj/layer/layer.js"></script>
  16. <script src="../../static/sa.js"></script>
  17. <script src="../../static/kj/upload-util.js"></script>
  18. <style type="text/css">
  19. .c-panel .el-form .c-label {
  20. width: 7em !important;
  21. }
  22. .c-panel .el-form .c-panel .el-form {
  23. width: 180px;
  24. }
  25. .item-num .el-input__inner {
  26. width: 130px;
  27. }
  28. .xj {
  29. display: inline;
  30. color: red;
  31. margin-left: 9px;
  32. font-weight: bold;
  33. }
  34. .hj {
  35. color: red;
  36. margin-left: 9px;
  37. font-weight: bold;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <div class="vue-box sbot" style="display: none;" :style="'display: block;'">
  43. <!-- ------- 内容部分 ------- -->
  44. <div class="s-body">
  45. <div class="c-panel">
  46. <div class="c-title">数据添加</div>
  47. <el-form v-if="m" label-position="left">
  48. <el-row>
  49. <el-card class="box-card">
  50. <div slot="header" class="clearfix">
  51. <span>基本资料</span>
  52. </div>
  53. <div>
  54. <el-row>
  55. <el-col span=8>
  56. <div class="c-item">
  57. <label class="c-label"><span style="color: red;">*</span>业务项目:</label>
  58. <el-select v-model="m.goodsId" placeholder="请选择" @change="goodsChange">
  59. <el-option v-for="item in goodsList" :key="item.id"
  60. :label="item.name" :value="item.id">
  61. </el-option>
  62. </el-select>
  63. </div>
  64. <div class="c-item" v-if="goods.needDeclare==1">
  65. <label class="c-label">
  66. <span style="color: red;">*</span>
  67. 申报单号:</label>
  68. <el-input v-model="m.declareNo" placeholder="选择申报单"
  69. :readonly="goods.needDeclare==1" clearable>
  70. </el-input>
  71. <div style="cursor: pointer;color: blue;display: inline;"
  72. @click="handlerDeclare">
  73. <i class="el-icon-folder-add"></i>
  74. </div>
  75. </div>
  76. </el-col>
  77. <el-col span=8>
  78. <div class="c-item">
  79. <label class="c-label"><span style="color: red;">*</span>客户:</label>
  80. <el-select
  81. :disabled="goods.needDeclare||m.declareNo||currentCustomerId!='1'"
  82. v-model="m.customerId" placeholder="请选择">
  83. <el-option v-for="item in customerList" :key="item.id"
  84. :label="item.name" :value="item.id">
  85. </el-option>
  86. </el-select>
  87. </div>
  88. <div class="c-item" v-if="goods.needOwner==1">
  89. <label class="c-label">
  90. <span style="color: red;">*</span>
  91. 货主:</label>
  92. <el-input v-model="m.owner" placeholder="填写货主" clearable>
  93. </el-input>
  94. </div>
  95. </el-col>
  96. <el-col span=8>
  97. <div class="c-item">
  98. <label class="c-label">作业人员:</label>
  99. <el-input v-model="m.operator" placeholder="作业人员" clearable>
  100. </el-input>
  101. </div>
  102. <div class="c-item">
  103. <label class="c-label"><span style="color: red;"
  104. v-if="goods.needOperateTime==1">*</span>作业时间:</label>
  105. <el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
  106. v-model="m.operateTime"></el-date-picker>
  107. </div>
  108. </el-col>
  109. </el-row>
  110. </div>
  111. </el-card>
  112. </el-row>
  113. <el-row>
  114. <el-card class="box-card">
  115. <div slot="header" class="clearfix">
  116. <span>车辆</span>
  117. <el-button style="float: right;" icon="el-icon-plus" type="primary"
  118. @click="showAddModal">添加
  119. </el-button>
  120. </div>
  121. <el-table :data="car.list">
  122. <el-table-column type="index" width="50" label="序号">
  123. </el-table-column>
  124. <el-table-column prop="carNo" label="车牌号">
  125. </el-table-column>
  126. <el-table-column prop="carSize" label="规格(米)">
  127. </el-table-column>
  128. <el-table-column prop="carType" label="类型">
  129. </el-table-column>
  130. <el-table-column prop="netWeight" label="载重(kg)">
  131. </el-table-column>
  132. <el-table-column label="操作">
  133. <template slot-scope="s">
  134. <el-button class="c-btn" type="info" @click="editFn(s.row)">修改</el-button>
  135. <el-button class="c-btn" type="danger" @click="deleteFn(s.row)">删除
  136. </el-button>
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. </el-card>
  141. </el-row>
  142. <el-row>
  143. <el-card class="box-card">
  144. <div slot="header" class="clearfix">
  145. <span>收费项</span>
  146. </div>
  147. <div>
  148. <el-form-item v-for="(type,index) in itemTypeList">
  149. <el-row>
  150. <el-col span="9">
  151. <div style="margin-top: 30px;">
  152. <label style="color: red;"
  153. v-if="type.need==1">*</label>{{type.name}}</label>
  154. <el-select v-model="type.itemId" style="width: 120px;"
  155. @change="itemChange(type)" placeholder="请选择">
  156. <el-option v-for="item in type.items" :key="item.id"
  157. :label="item.itemName" :value="item.id">
  158. </el-option>
  159. </el-select>
  160. </div>
  161. </el-col>
  162. <el-col span="7">
  163. <div style="margin-top: 30px;">
  164. <el-input-number style="margin-left: 60px;" class="item-num"
  165. v-model="type.num" :min="1" :max="10" size="mini"
  166. :disabled="type.inc==0"></el-input-number>
  167. <div class="xj" v-if="type.itemId">
  168. {{type.price*type.num}}元
  169. <label @click="cleanItem(type)"
  170. style="margin-left: 5px;cursor: pointer">(<i
  171. class="el-icon-delete"></i>)</label>
  172. </div>
  173. </div>
  174. </el-col>
  175. <el-col span="8">
  176. <div class="c-item" style="position: relative;bottom: 10px;">
  177. <label class="c-label"> 备注:</label>
  178. <el-input v-model="type.remark" placeholder="请输入备注" clearable>
  179. </el-input>
  180. </div>
  181. </el-col>
  182. </el-row>
  183. <el-divider></el-divider>
  184. </el-form-item>
  185. <div class="hj" v-if="totalPrice>0">
  186. 合计费用:{{totalPrice}}<label>元</label>
  187. </div>
  188. </div>
  189. </el-card>
  190. </el-row>
  191. </el-form>
  192. </div>
  193. </div>
  194. <!-- ------- 底部按钮 ------- -->
  195. <div class="s-foot">
  196. <el-button type="primary" @click="ok()">确定</el-button>
  197. <el-button @click="closeFn()">取消</el-button>
  198. </div>
  199. <el-dialog title="车辆录入" :visible.sync="car.visible" width="400">
  200. <span>
  201. <el-form label-position="left">
  202. <div class="c-item">
  203. <label class="c-label"><span style="color: red;">*</span>车牌号:</label>
  204. <el-autocomplete v-model="car.form.carNo" placeholder="请输入车牌号" value-key='carNo'
  205. :fetch-suggestions="queryCarAsync">
  206. </el-autocomplete>
  207. </div>
  208. <div class="c-item">
  209. <label class="c-label">车辆类型:</label>
  210. <el-select v-model="car.form.carType" placeholder="请选择" @change="carTypeChange">
  211. <el-option :label="item.name" :value="item.name" v-for="(item,index) in carTypeList">
  212. </el-option>
  213. </el-select>
  214. </div>
  215. <div class="c-item">
  216. <label class="c-label">
  217. <span style="color: red;" v-if="goods.needCarSize==1">*</span>
  218. 规格(米):</label>
  219. <el-input-number class="item-num" v-model="car.form.carSize" :min="1" :max="50">
  220. </el-input-number>
  221. </div>
  222. <div class="c-item" v-if="car.form.carType&&car.form.carType.indexOf('空')==-1">
  223. <label class="c-label">
  224. <span style="color: red;" v-if="goods.needCarSize==1">*</span>
  225. 载重(kg):</label>
  226. <el-input-number class="item-num" v-model="car.form.netWeight" :min="1" :max="999999">
  227. </el-input-number>
  228. </div>
  229. </el-form>
  230. </span>
  231. <span slot="footer" class="dialog-footer">
  232. <el-button @click="car.visible = false">取 消</el-button>
  233. <el-button type="primary" @click="confirmAdd">确 定</el-button>
  234. </span>
  235. </el-dialog>
  236. <el-dialog title="申报单" :visible.sync="declare.visible" width="90%">
  237. <div class="delect-search">
  238. 申报人:
  239. <el-input style="width: 140px;" v-model="declare.p.declarePeople" placeholder="申报人">
  240. </el-input>
  241. <el-button type="primary" @click="getDeclareList">搜索</el-button>
  242. <el-button type="info" @click="resetDclare">重置</el-button>
  243. </div>
  244. <el-card class="box-card" style="margin-top: 20px;">
  245. <div slot="header">
  246. <span>列表</span>
  247. </div>
  248. <el-table :data="declare.list" ref="declareTable">
  249. <el-table-column type="selection">
  250. </el-table-column>
  251. <el-table-column prop="declarePeople" label="申报人">
  252. </el-table-column>
  253. <el-table-column prop="customerName" label="申报公司" width=200>
  254. </el-table-column>
  255. <el-table-column prop="sendUnit" label="货主" width=200>
  256. </el-table-column>
  257. <el-table-column prop="createTime" width="140" label="申报时间">
  258. </el-table-column>
  259. <el-table-column prop="declareNo" width="180" label="申报单号">
  260. </el-table-column>
  261. <el-table-column prop="goodsName" label="产品学名">
  262. </el-table-column>
  263. <el-table-column prop="carNo" label="越南车牌">
  264. </el-table-column>
  265. <el-table-column prop="grossWeight" label="毛重(kg)">
  266. </el-table-column>
  267. </el-table>
  268. <div class="block">
  269. <el-pagination layout="prev, pager, next" @current-change="getDeclareList"
  270. :page-size="declare.p.pageSize" :total="declare.p.dataCount"
  271. :current-page="declare.p.pageNo">
  272. </el-pagination>
  273. </div>
  274. </el-card>
  275. <span slot="footer" class="dialog-footer">
  276. <el-button @click="declare.visible = false">取 消</el-button>
  277. <el-button type="primary" @click="confirmSelectDeclare">确 定</el-button>
  278. </span>
  279. </el-dialog>
  280. </div>
  281. <script>
  282. var app = new Vue({
  283. components: {
  284. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  285. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue')
  286. },
  287. el: '.vue-box',
  288. data: {
  289. m: {
  290. id: sa.p('id', ''), // 主键
  291. customerId: '', // 客户id
  292. customerName: '', // 客户名称
  293. operateTime: '',
  294. no: '', // 编号
  295. goodsId: '',
  296. goodsName: '', // 商品
  297. }, // 实体对象
  298. customerList: [],
  299. carList: [],
  300. currentCustomerId: 1,
  301. itemTypeList: [],
  302. filterTypeList: [],
  303. goodsList: [],
  304. tableData: [],
  305. car: {
  306. visible: false,
  307. list: [],
  308. form: {
  309. carNo: '',
  310. carType: '',
  311. netWeight: '',
  312. carSize: ''
  313. }
  314. },
  315. declare: {
  316. visible: false,
  317. list: [],
  318. p: {
  319. pageNo: 1,
  320. pageSize: 8,
  321. dataCount: 0,
  322. declarePeople: '',
  323. production: '',
  324. declareNo: '1'
  325. }
  326. },
  327. goods: {
  328. id: '',
  329. name: '',
  330. needWeight: 1,
  331. needCarSize: 1,
  332. needDeclare: 1,
  333. needOperateTime: 1,
  334. },
  335. carTypeList: [],
  336. intiItems: []
  337. },
  338. computed: {
  339. totalPrice() {
  340. let itemList = this.itemTypeList.filter(obj => obj.itemId);
  341. let price = 0;
  342. for (let i in itemList) {
  343. let type = itemList[i];
  344. let num = type.num;
  345. let items = type.items;
  346. for (let j in items) {
  347. let item = items[j];
  348. if (item.id == type.itemId) {
  349. price += num * item.price;
  350. break;
  351. }
  352. }
  353. }
  354. return price;
  355. }
  356. },
  357. methods: {
  358. resetDclare() {
  359. this.declare.p.pageNo = 1;
  360. this.declare.p.pageSize = 8;
  361. this.declare.p.production = '';
  362. this.declare.p.declarePeople = '';
  363. this.getDeclareList();
  364. },
  365. handlerDeclare() {
  366. this.declare.visible = true;
  367. this.getDeclareList();
  368. },
  369. getDeclareList() {
  370. let currentCustomerId = this.currentCustomerId;
  371. if (currentCustomerId != '1') {
  372. this.declare.p.customerId = this.currentCustomerId;
  373. }
  374. let declareNo = this.m.declareNo;
  375. if (declareNo) {
  376. this.declare.p.declareNo = declareNo;
  377. }
  378. sa.ajax('/TbDeclare/getNotBindList', sa.removeNull(this.declare.p), function(resp) {
  379. let list = resp.data;
  380. this.declare.list = list;
  381. this.declare.p.pageNo = resp.pageNo;
  382. this.declare.p.dataCount = resp.dataCount;
  383. list.forEach(row => {
  384. if (row.declareNo == this.m.declareNo) {
  385. this.$nextTick(() => {
  386. this.$refs['declareTable'].toggleRowSelection(row, true)
  387. })
  388. }
  389. })
  390. }.bind(this))
  391. },
  392. confirmSelectDeclare() {
  393. // 获取选中元素的id列表
  394. let selection = this.$refs['declareTable'].selection;
  395. let declareNo = sa.getArrayField(selection, 'declareNo');
  396. if (selection.length == 0) {
  397. return sa.msg('请至少选择一条数据')
  398. }
  399. if (selection.length > 1) {
  400. return sa.msg('只能选择一条数据')
  401. }
  402. let declare = selection[0];
  403. let oldNo = this.m.declareNo;
  404. if (oldNo && oldNo !== declare.declareNo) {
  405. this.car.list = [];
  406. }
  407. if (oldNo !== declare.declareNo) {
  408. this.m.declareNo = declare.declareNo;
  409. this.m.customerId = declare.customerId;
  410. this.m.customerName = declare.customerName;
  411. this.m.owner = declare.sendUnit;
  412. let carNo = declare.carNo;
  413. let grossWeight = declare.grossWeight;
  414. let carList = this.car.list;
  415. let exit = carList.filter(obj => obj.carNo == carNo).pop();
  416. if (!exit) {
  417. let car = {
  418. carNo: carNo,
  419. netWeight: grossWeight,
  420. carType: '载重'
  421. }
  422. this.car.list.push(car)
  423. }
  424. this.m.cardNo = declare.carNo;
  425. this.m.chinaCarNo = declare.chinaCarNo;
  426. this.m.netWeight = declare.grossWeight;
  427. let chinaCarNo = declare.chinaCarNo;
  428. if (chinaCarNo) {
  429. let list = [];
  430. chinaCarNo.replace(",", ",").split(",").forEach(carNo => {
  431. let exit = carList.filter(obj => obj.carNo == carNo).pop();
  432. if (!exit) {
  433. let car = {
  434. carNo: carNo,
  435. carType: '空车'
  436. }
  437. this.car.list.push(car)
  438. }
  439. })
  440. }
  441. this.filterItems();
  442. }
  443. this.declare.visible = false;
  444. },
  445. cleanItem(type) {
  446. type.itemId = '';
  447. type.itemName = '';
  448. type.price = '';
  449. },
  450. itemChange(type) {
  451. let itemId = type.itemId;
  452. let item = type.items.filter(obj => obj.id == itemId).pop();
  453. if (item) {
  454. type.inc = item.inc;
  455. type.price = item.price;
  456. }
  457. },
  458. confirmAdd() {
  459. let carNo = this.car.form.carNo;
  460. let netWeight = this.car.form.netWeight;
  461. let goods = this.goods;
  462. let form = this.car.form;
  463. let carType = form.carType;
  464. if (!carNo) {
  465. sa.error('请录入车牌号')
  466. return false;
  467. }
  468. if (!form.carSize && goods.needCarSize == 1) {
  469. sa.error('请填入车辆规格')
  470. return false;
  471. }
  472. if (carType.indexOf('空') !== -1) {
  473. netWeight = 0;
  474. }
  475. let list = this.car.list;
  476. let index = list.map(obj => obj.carNo).indexOf(carNo);
  477. if (index > -1) {
  478. list.splice(index, 1);
  479. }
  480. let carSize = form.carSize;
  481. let car = {
  482. id: form.id,
  483. carNo: form.carNo.toUpperCase(),
  484. carType: carType,
  485. carSize: carSize,
  486. netWeight: netWeight
  487. }
  488. this.car.list.push(car);
  489. this.car.visible = false;
  490. this.filterItems();
  491. },
  492. filterItems() {
  493. let carList = this.car.list;
  494. let length = carList.filter(obj => !obj.carType).length;
  495. if (carList.length == length) {
  496. return;
  497. }
  498. let filterTypeList = JSON.parse(JSON.stringify(this.filterTypeList));
  499. if (carList.length == 0) {
  500. this.itemTypeList = filterTypeList;
  501. return;
  502. }
  503. let car = carList[0];
  504. let checkCarList = carList.filter(car => car.carType && car.carType.indexOf('空') == -1);
  505. if (checkCarList.length > 0) {
  506. car = checkCarList[0];
  507. }
  508. let carSize = car.carSize;
  509. let carType = car.carType;
  510. let netWeight = car.netWeight;
  511. let tempList = [];
  512. for (let i in filterTypeList) {
  513. let type = filterTypeList[i];
  514. let items = type.items;
  515. if (carType) {
  516. items = items.filter(item => item.itemType && item.itemType.indexOf(carType) !== -1);
  517. }
  518. if (carSize && carSize > 1) {
  519. items = items.filter(item => item.minLength <= carSize && item.carLength >= carSize);
  520. }
  521. if (netWeight && netWeight > 1 && carType && carType.indexOf('空') == -1) {
  522. items = items.filter(item => item.minWeight <= netWeight && item.maxWeight >= netWeight);
  523. }
  524. let itemIds = items.map(item => item.id);
  525. if (itemIds.indexOf(type.itemId) == -1) {
  526. this.cleanItem(type);
  527. }
  528. type.items = items;
  529. tempList.push(type);
  530. }
  531. this.itemTypeList = tempList;
  532. },
  533. showAddModal() {
  534. this.car.visible = true;
  535. this.car.form.carNo = '';
  536. this.car.form.carSize = '';
  537. this.car.form.netWeight = '';
  538. },
  539. editFn(data) {
  540. Object.assign(this.car, {
  541. visible: true,
  542. form: data
  543. })
  544. },
  545. deleteFn(data) {
  546. this.car.list.splice(this.car.list.indexOf(data), 1);
  547. this.filterItems();
  548. },
  549. getGoods() {
  550. sa.ajaxNoLoading('/TbGoods/getList', {
  551. pageNo: 1,
  552. pageSize: 10
  553. }, function(resp) {
  554. let list = resp.data;
  555. this.goods = list.filter(goods => goods.id == this.m.goodsId).pop();
  556. this.goodsList = list;
  557. this.getTypeByGoodsId();
  558. }.bind(this))
  559. },
  560. goodsChange(v) {
  561. let goodsList = this.goodsList;
  562. let goods = goodsList.filter(goods => goods.id == v).pop();
  563. this.goods = goods;
  564. this.m.goodsName = goods.name;
  565. this.getTypeByGoodsId();
  566. },
  567. getTypeByGoodsId() {
  568. sa.ajax('/TbItemType/getTypeByGoodsId', {
  569. goodsId: this.m.goodsId
  570. }, function(resp) {
  571. let list = resp.data;
  572. let initItems = this.intiItems;
  573. for (let i in initItems) {
  574. let initItem = initItems[i];
  575. for (let j in list) {
  576. let type = list[j];
  577. if (type.id == initItem.itemTypeId) {
  578. type.num = initItem.num;
  579. type.price = initItem.itemPrice;
  580. type.itemId = initItem.itemId;
  581. type.remark = initItem.remark;
  582. }
  583. }
  584. }
  585. this.itemTypeList = list;
  586. this.filterTypeList = JSON.parse(JSON.stringify(this.itemTypeList));
  587. this.filterItems();
  588. }.bind(this))
  589. },
  590. getItemType() {
  591. sa.ajax('/TbItem/getItemType', function(resp) {
  592. let list = resp.data;
  593. if (list.length > 0) {
  594. this.car.form.carType = list[0].name;
  595. }
  596. this.carTypeList = list;
  597. }.bind(this))
  598. },
  599. carTypeChange(v) {
  600. },
  601. getCustomerList() {
  602. sa.ajax('/TbCostomer/getList', {
  603. pageNo: 1,
  604. pageSize: 30,
  605. sortType: 20,
  606. judgeStatus: 2
  607. }, function(res) {
  608. let list = res.data;
  609. this.customerList = list;
  610. }.bind(this));
  611. },
  612. queryCarAsync(queryStr, cb) {
  613. sa.ajaxNoLoading('/TbBusinessCar/searchByNo', {
  614. carNo: queryStr
  615. }, function(resp) {
  616. cb(resp.data)
  617. }.bind(this))
  618. },
  619. closeFn() {
  620. parent.app.f5();
  621. sa.closeCurrIframe();
  622. },
  623. // 提交数据
  624. ok: function() {
  625. let goods = this.goods;
  626. let m = this.m;
  627. if (goods.needDeclare == 1 && !m.declareNo) {
  628. sa.error('请选择申报单');
  629. return false;
  630. }
  631. if (goods.needOperateTime == 1 && !m.operateTime) {
  632. sa.error('请选择作业时间');
  633. return false;
  634. }
  635. if (!m.owner && goods.needOwner == 1) {
  636. sa.error('请填写货主');
  637. return false;
  638. }
  639. if (this.car.list.length == 0) {
  640. sa.error('请录入车辆');
  641. return false;
  642. }
  643. let carList = this.car.list;
  644. let needCarSize=goods.needCarSize;
  645. for(let i in carList){
  646. let car=carList[i];
  647. if(needCarSize==1&&!car.carSize){
  648. sa.error('请补充'+car.carNo+'规格');
  649. return;
  650. }
  651. }
  652. let typeList = this.itemTypeList;
  653. let selectList = [];
  654. for (let i in typeList) {
  655. let type = typeList[i];
  656. if (type.need == 1 && !type.itemId) {
  657. sa.error(type.name + '必选');
  658. return false;
  659. }
  660. if (type.itemId) {
  661. let obj = {
  662. typeId: type.id,
  663. typeName: type.name,
  664. id: type.itemId,
  665. num: type.num,
  666. price: type.price,
  667. remark: type.remark
  668. }
  669. selectList.push(obj);
  670. }
  671. }
  672. m.itemJson = JSON.stringify(selectList);
  673. m.carJson = JSON.stringify(carList);
  674. let chinaCarNo = carList
  675. .filter(car => sa.isCarNo(car.carNo.toUpperCase()))
  676. .map(car => car.carNo.toUpperCase())
  677. .join("、");
  678. let yueCarNo = carList
  679. .filter(car => !sa.isCarNo(car.carNo.toUpperCase()))
  680. .map(car => car.carNo.toUpperCase())
  681. .join("、");
  682. m.cardNo = yueCarNo;
  683. m.chinaCarNo = chinaCarNo;
  684. m.cars = null;
  685. m.items = null;
  686. sa.ajax('/TbBusiness/editOtherBusiness', sa.removeNull(m), function(res) {
  687. sa.alert('修改成功', this.clean);
  688. }.bind(this));
  689. },
  690. // 添加/修改 完成后的动作
  691. clean: function() {
  692. parent.app.f5(); // 刷新父页面列表
  693. sa.closeCurrIframe(); // 关闭本页
  694. },
  695. getCurrentCustomer() {
  696. sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
  697. let id = resp.data;
  698. this.currentCustomerId = id;
  699. }.bind(this));
  700. },
  701. getOtherBusinessById() {
  702. sa.ajax('/TbBusiness/getOtherBusinessById?id=' + this.m.id, function(resp) {
  703. let data = resp.data;
  704. this.car.list = data.cars;
  705. this.intiItems = data.items;
  706. this.m = resp.data;
  707. this.getGoods();
  708. }.bind(this))
  709. },
  710. },
  711. mounted: function() {
  712. this.getCurrentCustomer();
  713. this.getOtherBusinessById();
  714. this.getCustomerList();
  715. this.getItemType();
  716. }
  717. })
  718. </script>
  719. </body>
  720. </html>