add.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back"
  4. :title="form.id?'修改订单':'新建订单'" @clickLeft="back">
  5. </uni-nav-bar>
  6. <u-subsection :list="list" :current="current" @change="sectionChange"></u-subsection>
  7. <u-cell-group v-show='current==0'>
  8. <u-cell title="项目名称" arrow-direction="down">
  9. <u--input slot="value" placeholder="请选择" border="surround" v-model="form.projectName"
  10. @click.native="selectProjectShow"></u--input>
  11. </u-cell>
  12. <u-cell title="选择合同" arrow-direction="down">
  13. <u--input slot="value" placeholder="请选择" border="surround" v-model="form.contractName"
  14. @click.native="selectContractShow"></u--input>
  15. </u-cell>
  16. <u-cell title="销售类型" arrow-direction="down">
  17. <uni-data-picker v-model="form.saleType" slot="value" placeholder="请选择" :localdata="order_type">
  18. </uni-data-picker>
  19. </u-cell>
  20. <u-cell title="销售部门" arrow-direction="down">
  21. <u--input slot="value" placeholder="请选择" border="surround" v-model="form.salesDeptName"
  22. @click.native="salesDeptShow"></u--input>
  23. </u-cell>
  24. <u-cell title="合同编号" arrow-direction="down">
  25. <u--input slot="value" :disabled="true" placeholder="请输入" border="surround"
  26. v-model="form.contractNumber"></u--input>
  27. </u-cell>
  28. <u-cell title="结算方式" arrow-direction="down">
  29. <uni-data-picker v-model="form.settlementMode" slot="value" placeholder="请选择"
  30. :localdata="settlement_mode" @change="settlementModeChange">
  31. </uni-data-picker>
  32. </u-cell>
  33. <u-cell title="订单类型" arrow-direction="down">
  34. <radio-group v-model="form.needProduce" slot="value">
  35. <radio value="1" :checked="form.needProduce==1" @click="form.needProduce=1">生产性订单</radio>
  36. <radio value="0" :checked="form.needProduce==0" @click="form.needProduce=0">库存式订单</radio>
  37. <radio value="2" :checked="form.needProduce==2" @click="form.needProduce=2">无客户生产性订单</radio>
  38. </radio-group>
  39. </u-cell>
  40. <u-cell title="计价方式" arrow-direction="down">
  41. <radio-group @change="radioChange" v-model="form.pricingWay" slot="value">
  42. <radio :disabled="!!form.contractId" value="1" :checked="form.pricingWay==1">按数量计价</radio>
  43. <radio :disabled="!!form.contractId" value="2" :checked="form.pricingWay==2">按重量计价</radio>
  44. </radio-group>
  45. </u-cell>
  46. <u-cell title="自动生成采购计划" arrow-direction="down">
  47. <radio-group v-model="form.generatePurchase" slot="value">
  48. <radio value="1" :checked="form.generatePurchase==1" @click="form.generatePurchase=1">是</radio>
  49. <radio value="0" :checked="form.generatePurchase==0" @click="form.generatePurchase=0">否</radio>
  50. </radio-group>
  51. </u-cell>
  52. <u-cell title="自动生成生产计划" arrow-direction="down">
  53. <radio-group v-model="form.generateProduce" slot="value">
  54. <radio value="1" :checked="form.generateProduce==1" @click="form.generateProduce=1">是</radio>
  55. <radio value="0" :checked="form.generateProduce==0" @click="form.generateProduce=0">否</radio>
  56. </radio-group>
  57. </u-cell>
  58. <u-cell title="自动生成项目立项" arrow-direction="down">
  59. <radio-group v-model="form.generateProject" slot="value">
  60. <radio value="1" :checked="form.generateProject==1" @click="form.generateProject=1">是</radio>
  61. <radio value="0" :checked="form.generateProject==0" @click="form.generateProject=0">否</radio>
  62. </radio-group>
  63. </u-cell>
  64. <u-cell title="收货地址" arrow-direction="down">
  65. <u--textarea border="surround" v-model="form.receiveAddress" placeholder="请输入内容"
  66. slot="value"></u--textarea>
  67. </u-cell>
  68. <u-cell title="备注" arrow-direction="down">
  69. <u--textarea border="surround" v-model="form.remark" placeholder="请输入内容" slot="value"></u--textarea>
  70. </u-cell>
  71. </u-cell-group>
  72. <u-cell-group v-show='current==1&&form.needProduce!=2'>
  73. <u-cell title="客户名称" arrow-direction="down">
  74. <u--input slot="value" placeholder="请选择" border="surround" v-model="form.partaName"
  75. @click.native="selectContactShow"></u--input>
  76. </u-cell>
  77. <u-cell title="客户统一社会信用代码" arrow-direction="down">
  78. <u--input slot="value" placeholder="请输入" border="surround"
  79. v-model="form.partaUnifiedSocialCreditCode"></u--input>
  80. </u-cell>
  81. <u-cell title="客户联系人" arrow-direction="down">
  82. <uni-data-picker slot="value" v-model="form.partaLinkId" placeholder="请选择" :localdata="linkList"
  83. :map="{text:'linkName',value:'id'}" @change="linkChange">
  84. </uni-data-picker>
  85. </u-cell>
  86. <u-cell title="客户电话" arrow-direction="down">
  87. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.partaTel"></u--input>
  88. </u-cell>
  89. <u-cell title="客户传真" arrow-direction="down">
  90. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.partaFax"></u--input>
  91. </u-cell>
  92. <u-cell title="客户Email" arrow-direction="down">
  93. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.partaEmail"></u--input>
  94. </u-cell>
  95. <u-cell title="客户客户地址" arrow-direction="down">
  96. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.partaAddress"></u--input>
  97. </u-cell>
  98. <u-cell title="售出方名称" arrow-direction="down">
  99. <u--input slot="value" placeholder="请输入" v-if="enterprisePage.length <= 1" border="surround"
  100. v-model="form.partbName"></u--input>
  101. <uni-data-picker v-model="form.partbName" slot="value" placeholder="请选择" :localdata="enterprisePage"
  102. :map="{text:'name',value:'name'}" @change="sourceCodeOnchange">
  103. </uni-data-picker>
  104. </u-cell>
  105. <u-cell title="售出方统一社会信用代码" arrow-direction="down">
  106. <u--input slot="value" placeholder="请输入" border="surround"
  107. v-model="form.partbUnifiedSocialCreditCode"></u--input>
  108. </u-cell>
  109. <u-cell title="售出方联系人" arrow-direction="down">
  110. <u--input slot="value" placeholder="请选择" border="surround" v-model="form.partbLinkName"
  111. @click.native="selectUserShow"></u--input>
  112. </u-cell>
  113. <u-cell title="售出方联系电话" arrow-direction="down">
  114. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.partbTel"></u--input>
  115. </u-cell>
  116. <u-cell title="售出方传真" arrow-direction="down">
  117. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.partbFax"></u--input>
  118. </u-cell>
  119. <u-cell title="售出方Email" arrow-direction="down">
  120. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.partbEmail"></u--input>
  121. </u-cell>
  122. <u-cell title="售出方地址" arrow-direction="down">
  123. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.partbAddress"></u--input>
  124. </u-cell>
  125. </u-cell-group>
  126. <view class="footerButton">
  127. <u-button type="default" text="返回" @click="back"></u-button>
  128. <u-button type="primary" @click="save" text="保存"></u-button>
  129. </view>
  130. <view class="" v-show="current==2">
  131. <u-cell-group>
  132. <u-cell title="总金额" arrow-direction="down">
  133. <text slot="value"> {{ form.totalAmount || 0 }}元</text>
  134. </u-cell>
  135. <u-cell title="优惠后总金额" arrow-direction="down">
  136. <u--input type="number" @blur="discountInput" slot="value"
  137. :disabled="!!form.contractId || !form.totalAmount" placeholder="请输入" border="surround"
  138. v-model="form.payAmount">
  139. <template slot="suffix">元</template>
  140. </u--input>
  141. </u-cell>
  142. </u-cell-group>
  143. <produceList ref="produceListRef" :pricingWay="form.pricingWay" :contractId="form.contractId"
  144. :columns="columns"></produceList>
  145. </view>
  146. <u-toast ref="uToast"></u-toast>
  147. <ba-tree-picker ref="treePicker" :multiple="false" @select-change="confirm" :localdata="listData" valueKey="id"
  148. textKey="name" childrenKey="children" />
  149. </view>
  150. </template>
  151. <script>
  152. import {
  153. getByCode
  154. } from '@/api/pda/common.js'
  155. import {
  156. getcontactlink,
  157. } from '@/api/saleManage/contact/index.js'
  158. import {
  159. getContract,
  160. saveSaleorder,
  161. getSaleOrderDetail,
  162. } from '@/api/saleManage/saleorder'
  163. import {
  164. listOrganizations,
  165. } from '@/api/myTicket/index.js'
  166. import {
  167. enterprisePage,
  168. } from '@/api/mainData/index.js'
  169. import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
  170. import produceList from '../components/produceList.vue'
  171. export default {
  172. components: {
  173. produceList,
  174. baTreePicker
  175. },
  176. data() {
  177. return {
  178. list: ['订单信息', '基本信息', '产品清单'],
  179. current: 0,
  180. listData: [],
  181. userList: [],
  182. form: {
  183. id: '',
  184. contractId: '',
  185. orderFiles: [],
  186. contractName: '',
  187. salesDeptName: '',
  188. pricingWay: 1,
  189. payAmount: '',
  190. generatePurchase: 0,
  191. generateProduce: 0,
  192. generateProject: 0,
  193. projectName: '',
  194. projectId: '',
  195. receiveAddress: '',
  196. remark: '',
  197. saleType: '',
  198. saleTypeName: '',
  199. totalAmount: '',
  200. settlementMode: '4',
  201. settlementModeName: '分期付款',
  202. partaUnifiedSocialCreditCode: '',
  203. partbUnifiedSocialCreditCode: '',
  204. partaAddress: '',
  205. partaEmail: '',
  206. partaFax: '',
  207. partaId: '',
  208. partaLinkId: '',
  209. partaLinkName: '',
  210. partaName: '',
  211. partaTel: '',
  212. partbAddress: '',
  213. partbEmail: '',
  214. partbFax: '',
  215. partbId: '',
  216. partbLinkId: '',
  217. partbLinkName: '',
  218. partbName: '',
  219. partbTel: '',
  220. needProduce: 1
  221. },
  222. order_type: [],
  223. settlement_mode: [],
  224. linkList: [],
  225. enterprisePage: [],
  226. columns: [
  227. [{
  228. label: '产品名称:',
  229. prop: 'productName',
  230. type: 'title',
  231. className: 'perce100',
  232. }],
  233. [{
  234. label: '编码:',
  235. prop: 'productCode'
  236. }, {
  237. label: '牌号:',
  238. prop: 'productBrand'
  239. }],
  240. [{
  241. label: '规格:',
  242. prop: 'specification'
  243. }, {
  244. label: '型号:',
  245. prop: 'modelType'
  246. }],
  247. [{
  248. label: '数量:',
  249. prop: 'totalCount',
  250. slot: 'totalCount',
  251. }, {
  252. label: '计量单位:',
  253. prop: 'measuringUnit',
  254. }],
  255. [{
  256. label: '单价:',
  257. prop: 'singlePrice',
  258. slot: 'singlePrice',
  259. }, {
  260. label: '折让单价:',
  261. formatter: (item) => {
  262. return (item.discountSinglePrice ?
  263. Number(item.discountSinglePrice).toFixed(2) :
  264. '') + '元';
  265. }
  266. }],
  267. [{
  268. label: '合计:',
  269. prop: 'totalPrice',
  270. formatter: (item) => {
  271. return (item.totalPrice || '') + '元';
  272. }
  273. }, {
  274. label: '折让合计:',
  275. formatter: (item) => {
  276. return (item.discountTotalPrice ?
  277. Number(item.discountTotalPrice).toFixed(2) :
  278. '') + '元';
  279. }
  280. }],
  281. [{
  282. label: '客户代号:',
  283. prop: 'customerMark',
  284. slot: 'customerMark',
  285. }],
  286. [{
  287. label: '单重:',
  288. prop: 'singleWeight',
  289. slot: 'singleWeight',
  290. }, {
  291. label: '总重:',
  292. prop: 'totalWeight',
  293. }],
  294. [{
  295. label: '客户期望交期:',
  296. prop: 'customerExpectDeliveryDeadline',
  297. slot: 'customerExpectDeliveryDeadline',
  298. className: 'perce100',
  299. }],
  300. [{
  301. label: '质保期:',
  302. prop: 'guaranteePeriod',
  303. slot: 'guaranteePeriod',
  304. }, {
  305. label: '单位:',
  306. prop: 'guaranteePeriodUnitCode',
  307. slot: 'guaranteePeriodUnitCode',
  308. }],
  309. [{
  310. label: '操作:',
  311. prop: 'action',
  312. type: 'action',
  313. className: 'perce100',
  314. }],
  315. ],
  316. projectData: {}
  317. }
  318. },
  319. created() {
  320. this.getByCode()
  321. this.getDept()
  322. //选择合同回调
  323. uni.$off('setContractList')
  324. uni.$on('setContractList', async (data) => {
  325. if (data && data.length > 0) {
  326. this.form = Object.assign({}, this.form, {
  327. contractId: data[0].id,
  328. contractName: data[0].contractName
  329. });
  330. this.getContract(data[0].id);
  331. }
  332. })
  333. //选择客户回调
  334. uni.$off('setSelectList')
  335. uni.$on('setSelectList', async (data) => {
  336. if (data && data.length > 0) {
  337. this.changeParent(data[0])
  338. }
  339. })
  340. //总金额回显
  341. uni.$off('allsum')
  342. uni.$on('allsum', (allsum) => {
  343. this.form.totalAmount = allsum
  344. this.form.payAmount = allsum
  345. })
  346. //选择用户
  347. uni.$off('setUserInfo')
  348. uni.$on('setUserInfo', (data) => {
  349. if (data && data.length > 0) {
  350. this.$set(this.form, 'partbLinkId', data[0].id);
  351. this.$set(this.form, 'partbLinkName', data[0].name);
  352. this.$set(this.form, 'partbTel', data[0].phone);
  353. this.$set(this.form, 'partbEmail', data[0].email);
  354. }
  355. })
  356. //选择项目
  357. uni.$off('setProject')
  358. uni.$on('setProject', async (data) => {
  359. if (data && data.length > 0) {
  360. this.projectData = data[0];
  361. this.form = Object.assign({}, this.form, {
  362. projectName: this.projectData.name,
  363. projectId: this.projectData.id
  364. });
  365. if (this.projectData.contractId) {
  366. this.form = Object.assign({}, this.form, {
  367. contractId: this.projectData.contractId,
  368. contractName: this.projectData.contractName
  369. });
  370. this.getContract(this.projectData.contractId);
  371. } else if (this.projectData.contactId) {
  372. const data = await contactDetail(this.projectData.contactId);
  373. if (data.base?.id) {
  374. this.changeParent(data.base);
  375. }
  376. }
  377. }
  378. })
  379. },
  380. onLoad(data) {
  381. if (data && data.id) {
  382. this.getSaleOrderDetail(data.id)
  383. }
  384. this.enterprisePageFn(data.id)
  385. },
  386. onUnload() {
  387. uni.$off('setContractList')
  388. uni.$off('setSelectList')
  389. uni.$off('allsum')
  390. uni.$off('setUserInfo')
  391. uni.$off('setProject')
  392. },
  393. methods: {
  394. getDept() {
  395. listOrganizations(1).then(data => {
  396. this.listData = data
  397. })
  398. },
  399. //获取订单详情
  400. async getSaleOrderDetail(id) {
  401. const data = await getSaleOrderDetail(id);
  402. if (data) {
  403. this.$nextTick(() => {
  404. this.form = data;
  405. this.$refs.produceListRef.init(data.productList)
  406. this.getLinkInfo(data.partaId);
  407. });
  408. }
  409. },
  410. getByCode() {
  411. const codeS = ['order_type', 'settlement_mode']
  412. codeS.forEach(async (code) => {
  413. const codeValue = await getByCode(code);
  414. this[code] = codeValue.map(item => {
  415. const key = Object.keys(item)[0]
  416. return {
  417. value: key,
  418. text: item[key]
  419. }
  420. })
  421. })
  422. },
  423. enterprisePageFn(id) {
  424. enterprisePage({
  425. pageNum: 1,
  426. size: 100
  427. }).then((res) => {
  428. this.enterprisePage = res.list;
  429. if (!id) {
  430. this.form.partbName = this.enterprisePage[0].name;
  431. this.form.partbUnifiedSocialCreditCode =
  432. this.enterprisePage[0].unifiedSocialCreditCode;
  433. this.form.partbFax = this.enterprisePage[0].fax;
  434. this.form.partbAddress = this.enterprisePage[0].address;
  435. }
  436. });
  437. },
  438. discountInput() {
  439. this.$refs.produceListRef.discountInputByOrder(this.form.payAmount)
  440. },
  441. settlementModeChange(e) {
  442. this.form.settlementModeName = e.detail.value[0].text;
  443. },
  444. //选择部门
  445. salesDeptShow() {
  446. this.$refs.treePicker._show()
  447. },
  448. //部门回调
  449. confirm(data, name) {
  450. this.form.salesDeptName = name || ''
  451. this.form.salesDeptId = data[0] || ''
  452. },
  453. //选择客户
  454. selectContactShow() {
  455. if (this.form.contractId) {
  456. this.$refs.uToast.show({
  457. type: "error",
  458. message: "选择了合同不能更改客户",
  459. })
  460. return
  461. }
  462. uni.navigateTo({
  463. url: '/pages/saleManage/components/selectContact?isAll=' + 2
  464. })
  465. },
  466. //选择客户回调
  467. async changeParent(obj) {
  468. this.form = Object.assign({}, this.form, {
  469. partaId: obj.id,
  470. partaName: obj.name,
  471. partaAddress: obj.addressName + obj.address,
  472. partaLinkId: '',
  473. partaLinkName: '',
  474. partaEmail: '',
  475. partaTel: '',
  476. customerMark: obj.serialNo
  477. });
  478. await this.getLinkInfo(obj.id);
  479. this.$nextTick(() => {
  480. let firstLink =
  481. this.linkList.find((item) => item.ifChief == 1) || {};
  482. this.form = Object.assign({}, this.form, {
  483. partaLinkId: firstLink.id || this.linkList[0]?.id,
  484. partaLinkName: firstLink.linkName || this.linkList[0]?.linkName,
  485. partaTel: firstLink.mobilePhone || this.linkList[0]?.mobilePhone
  486. });
  487. this.setCustomerMark();
  488. });
  489. },
  490. setCustomerMark() {
  491. this.$refs.produceListRef.setCustomerMark(this.form.customerMark)
  492. },
  493. //选择用户
  494. selectUserShow() {
  495. uni.navigateTo({
  496. url: '/pages/saleManage/components/selectUser?isAll=' + 2
  497. })
  498. },
  499. //选择合同
  500. selectContractShow() {
  501. uni.navigateTo({
  502. url: '/pages/saleManage/components/selectContract?isAll=' + 2
  503. })
  504. },
  505. //选择合同
  506. selectProjectShow() {
  507. uni.navigateTo({
  508. url: '/pages/saleManage/components/selectProject?isAll=' + 2
  509. })
  510. },
  511. //选择合同获取合同的详情
  512. async getContract(id) {
  513. const data = await getContract(id);
  514. if (data) {
  515. this.$nextTick(() => {
  516. let {
  517. contractVO
  518. } = data;
  519. // this.form=contractVOform.receiveAddress
  520. let {
  521. partaAddress,
  522. partaEmail,
  523. partaFax,
  524. partaId,
  525. partaLinkId,
  526. partaLinkName,
  527. partaName,
  528. partaTel,
  529. partbAddress,
  530. partbEmail,
  531. partbFax,
  532. partbId,
  533. partbLinkId,
  534. partbLinkName,
  535. partbName,
  536. partbTel,
  537. totalPrice,
  538. discountTotalPrice,
  539. partaUnifiedSocialCreditCode,
  540. partbUnifiedSocialCreditCode,
  541. settlementMode,
  542. settlementModeName,
  543. pricingWay,
  544. contractNo,
  545. contractNumber
  546. } = contractVO;
  547. this.form = Object.assign({}, this.form, {
  548. partaAddress,
  549. partaEmail,
  550. partaFax,
  551. partaId,
  552. partaLinkId,
  553. partaLinkName,
  554. partaName,
  555. partaTel,
  556. partbAddress,
  557. partbEmail,
  558. partbFax,
  559. partbId,
  560. partbLinkId,
  561. partbLinkName,
  562. partbName,
  563. partbTel,
  564. pricingWay,
  565. totalPrice,
  566. discountTotalPrice,
  567. partaUnifiedSocialCreditCode,
  568. partbUnifiedSocialCreditCode,
  569. totalAmount: totalPrice,
  570. payAmount: discountTotalPrice || totalPrice,
  571. receiveAddress: partaAddress,
  572. settlementMode,
  573. settlementModeName,
  574. contractNo,
  575. contractNumber
  576. });
  577. this.getLinkInfo(partaId);
  578. this.$refs.produceListRef.init(data.productList)
  579. });
  580. }
  581. },
  582. //更新联系人数据
  583. async getLinkInfo(contactId) {
  584. const data = await getcontactlink({
  585. contactId
  586. });
  587. if (data && data?.length) {
  588. this.linkList = data;
  589. }
  590. },
  591. sourceCodeOnchange(e) {
  592. const value = e.detail.value
  593. this.form.sourceCode = value.map(item => item.value).toString()
  594. this.form.sourceName = value.map(item => item.text).toString()
  595. },
  596. linkChange(e) {
  597. const value = e.detail.value
  598. if (value.length > 0) {
  599. const data = this.linkList.find(item => item.id == value[0].value)
  600. this.form = Object.assign({}, this.form, {
  601. partaEmail: data?.email,
  602. partaLinkName: data?.linkName || '',
  603. partaTel: data?.mobilePhone || data?.phone || '',
  604. partaLinkId: data?.id
  605. });
  606. }
  607. },
  608. radioChange(e) {
  609. this.form.pricingWay = e.detail.value
  610. this.$nextTick(() => {
  611. this.$refs.produceListRef.getTotalPrice()
  612. })
  613. },
  614. sectionChange(index) {
  615. this.current = index;
  616. },
  617. async save() {
  618. try {
  619. if (!this.form.settlementMode) {
  620. this.$refs.uToast.show({
  621. type: "error",
  622. message: "请选择结算方式",
  623. })
  624. return
  625. }
  626. if (!this.form.saleType) {
  627. this.$refs.uToast.show({
  628. type: "error",
  629. message: "请选择销售类型",
  630. })
  631. return
  632. }
  633. if (!this.form.partaName) {
  634. this.$refs.uToast.show({
  635. type: "error",
  636. message: "请选择客户",
  637. })
  638. return
  639. }
  640. if (!this.form.partaLinkName) {
  641. this.$refs.uToast.show({
  642. type: "error",
  643. message: "请选择客户联系人",
  644. })
  645. return
  646. }
  647. if (!this.form.partaTel) {
  648. this.$refs.uToast.show({
  649. type: "error",
  650. message: "请输入客户联系电话",
  651. })
  652. return
  653. }
  654. if (!this.form.partbName) {
  655. this.$refs.uToast.show({
  656. type: "error",
  657. message: "请输入售出方名称",
  658. })
  659. return
  660. }
  661. if (!this.form.partbLinkName) {
  662. this.$refs.uToast.show({
  663. type: "error",
  664. message: "请输入售出方联系人",
  665. })
  666. return
  667. }
  668. if (!this.form.partbTel) {
  669. this.$refs.uToast.show({
  670. type: "error",
  671. message: "请输入售出方联系电话",
  672. })
  673. return
  674. }
  675. if (this.$refs.produceListRef.getValue().length == 0) {
  676. this.$refs.uToast.show({
  677. type: "error",
  678. message: "产品清单不能为空",
  679. })
  680. return;
  681. }
  682. uni.showLoading({
  683. title: '加载中'
  684. })
  685. const saleTypeName = this.order_type.find(item => item.value == this.form.saleType)?.text
  686. const data = Object.assign({}, this.form, {
  687. productList: this.$refs.produceListRef.getValue(),
  688. saleTypeName
  689. })
  690. saveSaleorder(data)
  691. .then((id) => {
  692. uni.hideLoading()
  693. this.back()
  694. })
  695. .catch((e) => {
  696. uni.hideLoading()
  697. });
  698. } catch (error) {
  699. uni.hideLoading()
  700. console.log(error, 'error')
  701. }
  702. },
  703. }
  704. }
  705. </script>
  706. <style lang="scss" scoped>
  707. /deep/.u-cell__body__content {
  708. flex: none;
  709. margin-right: 16rpx;
  710. }
  711. .mainBox {
  712. padding-bottom: 84rpx;
  713. }
  714. .footerButton {
  715. width: 100%;
  716. height: 84rpx;
  717. display: flex;
  718. position: fixed;
  719. bottom: 0;
  720. z-index: 10;
  721. /deep/.u-button {
  722. height: 100%;
  723. }
  724. >view {
  725. flex: 1;
  726. }
  727. }
  728. /deep/.u-subsection__item__text {
  729. font-size: 28rpx !important;
  730. }
  731. </style>