add.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  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. }
  317. },
  318. created() {
  319. this.getByCode()
  320. this.getDept()
  321. //选择合同回调
  322. uni.$off('setContractList')
  323. uni.$on('setContractList', async (data) => {
  324. if (data && data.length > 0) {
  325. this.form = Object.assign({}, this.form, {
  326. contractId: data[0].id,
  327. contractName: data[0].contractName
  328. });
  329. this.getContract(data[0].id);
  330. }
  331. })
  332. //选择客户回调
  333. uni.$off('setSelectList')
  334. uni.$on('setSelectList', async (data) => {
  335. if (data && data.length > 0) {
  336. this.changeParent(data[0])
  337. }
  338. })
  339. //总金额回显
  340. uni.$off('allsum')
  341. uni.$on('allsum', (allsum) => {
  342. this.form.totalAmount = allsum
  343. this.form.payAmount = allsum
  344. })
  345. //选择用户
  346. uni.$off('setUserInfo')
  347. uni.$on('setUserInfo', (data) => {
  348. if (data && data.length > 0) {
  349. this.$set(this.form, 'partbLinkId', data[0].id);
  350. this.$set(this.form, 'partbLinkName', data[0].name);
  351. this.$set(this.form, 'partbTel', data[0].phone);
  352. this.$set(this.form, 'partbEmail', data[0].email);
  353. }
  354. })
  355. },
  356. onLoad(data) {
  357. if (data && data.id) {
  358. this.getSaleOrderDetail(data.id)
  359. }
  360. this.enterprisePageFn(data.id)
  361. },
  362. onUnload() {
  363. uni.$off('setContractList')
  364. uni.$off('setSelectList')
  365. uni.$off('allsum')
  366. uni.$off('setUserInfo')
  367. },
  368. methods: {
  369. getDept() {
  370. listOrganizations(1).then(data => {
  371. this.listData = data
  372. })
  373. },
  374. //获取订单详情
  375. async getSaleOrderDetail(id) {
  376. const data = await getSaleOrderDetail(id);
  377. if (data) {
  378. this.$nextTick(() => {
  379. this.form = data;
  380. this.$refs.produceListRef.init(data.productList)
  381. this.getLinkInfo(data.partaId);
  382. });
  383. }
  384. },
  385. getByCode() {
  386. const codeS = ['order_type', 'settlement_mode']
  387. codeS.forEach(async (code) => {
  388. const codeValue = await getByCode(code);
  389. this[code] = codeValue.map(item => {
  390. const key = Object.keys(item)[0]
  391. return {
  392. value: key,
  393. text: item[key]
  394. }
  395. })
  396. })
  397. },
  398. enterprisePageFn(id) {
  399. enterprisePage({
  400. pageNum: 1,
  401. size: 100
  402. }).then((res) => {
  403. this.enterprisePage = res.list;
  404. if (!id) {
  405. this.form.partbName = this.enterprisePage[0].name;
  406. this.form.partbUnifiedSocialCreditCode =
  407. this.enterprisePage[0].unifiedSocialCreditCode;
  408. this.form.partbFax = this.enterprisePage[0].fax;
  409. this.form.partbAddress = this.enterprisePage[0].address;
  410. }
  411. });
  412. },
  413. discountInput() {
  414. this.$refs.produceListRef.discountInputByOrder(this.form.payAmount)
  415. },
  416. settlementModeChange(e) {
  417. this.form.settlementModeName = e.detail.value[0].text;
  418. },
  419. //选择部门
  420. salesDeptShow() {
  421. this.$refs.treePicker._show()
  422. },
  423. //部门回调
  424. confirm(data, name) {
  425. this.form.salesDeptName = name || ''
  426. this.form.salesDeptId = data[0] || ''
  427. },
  428. //选择客户
  429. selectContactShow() {
  430. if (this.form.contractId) {
  431. this.$refs.uToast.show({
  432. type: "error",
  433. message: "选择了合同不能更改客户",
  434. })
  435. return
  436. }
  437. uni.navigateTo({
  438. url: '/pages/saleManage/components/selectContact?isAll=' + 2
  439. })
  440. },
  441. //选择客户回调
  442. async changeParent(obj) {
  443. this.form = Object.assign({}, this.form, {
  444. partaId: obj.id,
  445. partaName: obj.name,
  446. partaAddress: obj.addressName + obj.address,
  447. partaLinkId: '',
  448. partaLinkName: '',
  449. partaEmail: '',
  450. partaTel: '',
  451. customerMark: obj.serialNo
  452. });
  453. await this.getLinkInfo(obj.id);
  454. this.$nextTick(() => {
  455. let firstLink =
  456. this.linkList.find((item) => item.ifChief == 1) || {};
  457. this.form = Object.assign({}, this.form, {
  458. partaLinkId: firstLink.id || this.linkList[0]?.id,
  459. partaLinkName: firstLink.linkName || this.linkList[0]?.linkName,
  460. partaTel: firstLink.mobilePhone || this.linkList[0]?.mobilePhone
  461. });
  462. this.setCustomerMark();
  463. });
  464. },
  465. setCustomerMark() {
  466. this.$refs.produceListRef.setCustomerMark(this.form.customerMark)
  467. },
  468. //选择用户
  469. selectUserShow() {
  470. uni.navigateTo({
  471. url: '/pages/saleManage/components/selectUser?isAll=' + 2
  472. })
  473. },
  474. //选择合同
  475. selectContractShow() {
  476. uni.navigateTo({
  477. url: '/pages/saleManage/components/selectContract?isAll=' + 2
  478. })
  479. },
  480. //选择合同获取合同的详情
  481. async getContract(id) {
  482. const data = await getContract(id);
  483. if (data) {
  484. this.$nextTick(() => {
  485. let {
  486. contractVO
  487. } = data;
  488. // this.form=contractVOform.receiveAddress
  489. let {
  490. partaAddress,
  491. partaEmail,
  492. partaFax,
  493. partaId,
  494. partaLinkId,
  495. partaLinkName,
  496. partaName,
  497. partaTel,
  498. partbAddress,
  499. partbEmail,
  500. partbFax,
  501. partbId,
  502. partbLinkId,
  503. partbLinkName,
  504. partbName,
  505. partbTel,
  506. totalPrice,
  507. discountTotalPrice,
  508. partaUnifiedSocialCreditCode,
  509. partbUnifiedSocialCreditCode,
  510. settlementMode,
  511. settlementModeName,
  512. pricingWay,
  513. contractNo,
  514. contractNumber
  515. } = contractVO;
  516. this.form = Object.assign({}, this.form, {
  517. partaAddress,
  518. partaEmail,
  519. partaFax,
  520. partaId,
  521. partaLinkId,
  522. partaLinkName,
  523. partaName,
  524. partaTel,
  525. partbAddress,
  526. partbEmail,
  527. partbFax,
  528. partbId,
  529. partbLinkId,
  530. partbLinkName,
  531. partbName,
  532. partbTel,
  533. pricingWay,
  534. totalPrice,
  535. discountTotalPrice,
  536. partaUnifiedSocialCreditCode,
  537. partbUnifiedSocialCreditCode,
  538. totalAmount: totalPrice,
  539. payAmount: discountTotalPrice || totalPrice,
  540. receiveAddress: partaAddress,
  541. settlementMode,
  542. settlementModeName,
  543. contractNo,
  544. contractNumber
  545. });
  546. this.getLinkInfo(partaId);
  547. this.$refs.produceListRef.init(data.productList)
  548. });
  549. }
  550. },
  551. //更新联系人数据
  552. async getLinkInfo(contactId) {
  553. const data = await getcontactlink({
  554. contactId
  555. });
  556. if (data && data?.length) {
  557. this.linkList = data;
  558. }
  559. },
  560. sourceCodeOnchange(e) {
  561. const value = e.detail.value
  562. this.form.sourceCode = value.map(item => item.value).toString()
  563. this.form.sourceName = value.map(item => item.text).toString()
  564. },
  565. linkChange(e) {
  566. const value = e.detail.value
  567. if (value.length > 0) {
  568. const data = this.linkList.find(item => item.id == value[0].value)
  569. this.form = Object.assign({}, this.form, {
  570. partaEmail: data?.email,
  571. partaLinkName: data?.linkName || '',
  572. partaTel: data?.mobilePhone || data?.phone || '',
  573. partaLinkId: data?.id
  574. });
  575. }
  576. },
  577. radioChange(e) {
  578. this.form.pricingWay = e.detail.value
  579. this.$nextTick(() => {
  580. this.$refs.produceListRef.getTotalPrice()
  581. })
  582. },
  583. sectionChange(index) {
  584. this.current = index;
  585. },
  586. async save() {
  587. try {
  588. if (!this.form.settlementMode) {
  589. this.$refs.uToast.show({
  590. type: "error",
  591. message: "请选择结算方式",
  592. })
  593. return
  594. }
  595. if (!this.form.saleType) {
  596. this.$refs.uToast.show({
  597. type: "error",
  598. message: "请选择销售类型",
  599. })
  600. return
  601. }
  602. if (!this.form.partaName) {
  603. this.$refs.uToast.show({
  604. type: "error",
  605. message: "请选择客户",
  606. })
  607. return
  608. }
  609. if (!this.form.partaLinkName) {
  610. this.$refs.uToast.show({
  611. type: "error",
  612. message: "请选择客户联系人",
  613. })
  614. return
  615. }
  616. if (!this.form.partaTel) {
  617. this.$refs.uToast.show({
  618. type: "error",
  619. message: "请输入客户联系电话",
  620. })
  621. return
  622. }
  623. if (!this.form.partbName) {
  624. this.$refs.uToast.show({
  625. type: "error",
  626. message: "请输入售出方名称",
  627. })
  628. return
  629. }
  630. if (!this.form.partbLinkName) {
  631. this.$refs.uToast.show({
  632. type: "error",
  633. message: "请输入售出方联系人",
  634. })
  635. return
  636. }
  637. if (!this.form.partbTel) {
  638. this.$refs.uToast.show({
  639. type: "error",
  640. message: "请输入售出方联系电话",
  641. })
  642. return
  643. }
  644. if (this.$refs.produceListRef.getValue().length == 0) {
  645. this.$message.warning('产品清单不能为空');
  646. return;
  647. }
  648. uni.showLoading({
  649. title: '加载中'
  650. })
  651. const saleTypeName = this.order_type.find(item => item.value == this.form.saleType)?.text
  652. const data = Object.assign({}, this.form, {
  653. productList: this.$refs.produceListRef.getValue(),
  654. saleTypeName
  655. })
  656. saveSaleorder(data)
  657. .then((id) => {
  658. uni.hideLoading()
  659. this.back()
  660. })
  661. .catch((e) => {
  662. uni.hideLoading()
  663. });
  664. } catch (error) {
  665. uni.hideLoading()
  666. console.log(error, 'error')
  667. }
  668. },
  669. }
  670. }
  671. </script>
  672. <style lang="scss" scoped>
  673. /deep/.u-cell__body__content {
  674. flex: none;
  675. margin-right: 16rpx;
  676. }
  677. .mainBox {
  678. padding-bottom: 84rpx;
  679. }
  680. .footerButton {
  681. width: 100%;
  682. height: 84rpx;
  683. display: flex;
  684. position: fixed;
  685. bottom: 0;
  686. z-index: 10;
  687. /deep/.u-button {
  688. height: 100%;
  689. }
  690. >view {
  691. flex: 1;
  692. }
  693. }
  694. /deep/.u-subsection__item__text {
  695. font-size: 24rpx !important;
  696. }
  697. </style>