edit.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951
  1. <template>
  2. <div>
  3. <!-- <el-button :disabled="data.status !=='新建'" type="primary" size="mini" @click="onShow(drawer = true)">{{$t('编 辑')}}</el-button> -->
  4. <el-button
  5. type="primary"
  6. :disabled="data.type === '特殊订单'"
  7. size="mini"
  8. @click="onShow((drawer = true))"
  9. >{{ $t("编 辑") }}</el-button
  10. >
  11. <el-drawer :visible.sync="drawer" :wrapperClosable="false" direction="rtl" append-to-body size="80%">
  12. <div slot="title">
  13. <div class="flex-align-center">
  14. <p>
  15. <span style="font-size: 14px">{{ $t("订单合计") }}:</span
  16. ><span style="color: red; font-size: 16px"
  17. ><b
  18. >¥&nbsp;{{ tool.formatAmount(data.defaultamount, 2) }}</b
  19. ></span
  20. >
  21. </p>
  22. </div>
  23. <div class="flex-align-center">
  24. <p
  25. v-if="freefreightamount"
  26. style="
  27. font-size: 13px !important;
  28. color: #8888;
  29. font-weight: normal;
  30. "
  31. >
  32. {{ $t(checkFreefreightamount) }}
  33. </p>
  34. </div>
  35. </div>
  36. <div class="drawer__panel">
  37. <!-- 项目订单显示信息 -->
  38. <div
  39. v-if="data.type === '项目订单'"
  40. class="reveive__panel normal-margin flex-align-center"
  41. >
  42. <p class="inline-16">
  43. <small>{{ $t("项目信息") }}:</small>{{ data.projectname }}
  44. </p>
  45. <p class="inline-16">
  46. <small>{{ $t("合同信息") }}:</small>{{ data.contract_title }}
  47. </p>
  48. <p class="inline-16">
  49. <small>{{ $t("领域") }}:</small>{{ data.tradefield }}
  50. </p>
  51. <p class="inline-16">
  52. <small>{{ $t("品牌") }}:</small>{{ data.brandname }}
  53. </p>
  54. </div>
  55. <div>
  56. <div class="mt-10">
  57. <p class="normal-title inline-16">{{ $t("支付信息") }}</p>
  58. </div>
  59. <div class="reveive__panel normal-margin">
  60. <p class="flex-align-center">
  61. <small>{{ $t("结算企业") }}:&nbsp;</small
  62. ><b>{{ defaultData.finance.enterprisename }}</b
  63. >&nbsp;<financeEnterprise
  64. v-if="data.type !== '项目订单'"
  65. @select="onSelect"
  66. ></financeEnterprise>
  67. </p>
  68. <div class="flex-align-center">
  69. <p class="inline-16">
  70. <small>{{ $t("账户余额") }}:&nbsp;</small
  71. ><b
  72. >¥{{
  73. tool.formatAmount(
  74. defaultData.accountclass.balance
  75. ? defaultData.accountclass.balance
  76. : 0,
  77. 2
  78. )
  79. }}</b
  80. >
  81. </p>
  82. <p class="inline-16">
  83. <small>{{ $t("账户名称") }}:&nbsp;</small
  84. >{{
  85. defaultData.accountclass.accountname
  86. ? $t(defaultData.accountclass.accountname)
  87. : $t("未选择账户")
  88. }}
  89. </p>
  90. <p>
  91. <small>{{ $t("本单金额") }}:&nbsp;</small
  92. >{{
  93. data.rebate_used
  94. ? tool.formatAmount(data.defaultamount - rebateamount, 2)
  95. : data.defaultamount
  96. }}
  97. </p>
  98. </div>
  99. <div
  100. v-if="
  101. (data.type === '标准订单' || data.type === '特殊订单') &&
  102. isusedrebate === 1
  103. "
  104. >
  105. <el-checkbox
  106. v-model="checked"
  107. :true-label="1"
  108. :false-label="0"
  109. @change="rebateUsedChange"
  110. >{{ $t("使用返利金") }}</el-checkbox
  111. >
  112. <div v-if="checked" class="flex-align-center">
  113. <p class="inline-16">
  114. <b
  115. >{{ $t("返利金余额") }}:{{
  116. tool.formatAmount(defaultData.rebatebalance, 2)
  117. }}</b
  118. >
  119. </p>
  120. <el-input
  121. class="inline-16"
  122. size="mini"
  123. style="width: 150px"
  124. v-model="data.rebateamount"
  125. @blur="useRebate(data.rebateamount)"
  126. :placeholder="$t(`输入使用金额`)"
  127. ></el-input>
  128. <small
  129. >({{ $t("返利金最高使用比例")
  130. }}{{ data.order_rebate_userate }})</small
  131. >
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. <div class="flex-align-center normal-margin">
  137. <div style="flex: 1; margin-right: 10px">
  138. <div class="mt-10">
  139. <p class="normal-title inline-16">{{ $t("选择财务信息") }}</p>
  140. <el-popover
  141. placement="bottom"
  142. :title="$t(`选择财务信息`)"
  143. trigger="click"
  144. v-model="visible2"
  145. >
  146. <addAmountInfo
  147. style="text-align: right"
  148. :data="{ sys_enterpriseid: data.sys_enterpriseid }"
  149. @onSuccess="
  150. thisDetail()
  151. .queryMainData()
  152. .then(() => {
  153. setDefaultData();
  154. })
  155. "
  156. />
  157. <el-table :data="financiallist" style="width: 100%" size="mini">
  158. <el-table-column
  159. prop="enterprisename"
  160. :label="$t(`公司抬头`)"
  161. width="120"
  162. >
  163. </el-table-column>
  164. <el-table-column
  165. prop="address"
  166. :label="$t('开票地址')"
  167. width="120"
  168. >
  169. </el-table-column>
  170. <el-table-column
  171. prop="bank"
  172. :label="$t('开户行')"
  173. width="120"
  174. >
  175. </el-table-column>
  176. <el-table-column
  177. prop="bankcardno"
  178. :label="$t('开户账号')"
  179. width="120"
  180. >
  181. </el-table-column>
  182. <el-table-column :label="$t('操作')" width="120">
  183. <template slot-scope="scope">
  184. <el-button
  185. class="inline-16"
  186. type="text"
  187. @click="
  188. (defaultData.fin_info = scope.row), (visible2 = false)
  189. "
  190. size="mini"
  191. >{{ $t("选 择") }}</el-button
  192. >
  193. <delete-btn
  194. message="确定删除当前信息吗?"
  195. nameId="20221013160502"
  196. nameKey="sys_enterprise_financeids"
  197. :id="scope.row.sys_enterprise_financeid"
  198. @deleteSuccess="
  199. thisDetail()
  200. .queryMainData()
  201. .then(() => {
  202. setDefaultData();
  203. })
  204. "
  205. ></delete-btn>
  206. </template>
  207. </el-table-column>
  208. </el-table>
  209. <el-button slot="reference" type="text" size="mini">{{
  210. $t("选择其他")
  211. }}</el-button>
  212. </el-popover>
  213. </div>
  214. <div class="reveive__panel normal-margin">
  215. <p>
  216. <small>{{ $t("抬头") }}:&nbsp;</small
  217. ><span class="inline-16"
  218. ><b>{{ defaultData.fin_info.enterprisename }}</b></span
  219. >
  220. </p>
  221. <div class="flex-align-center">
  222. <p class="inline-16">
  223. <small>{{ $t("开票地址") }}:&nbsp;</small
  224. >{{
  225. defaultData.fin_info.address
  226. ? defaultData.fin_info.address
  227. : "--"
  228. }}
  229. </p>
  230. <p>
  231. <small>{{ $t("开户行") }}:&nbsp;</small>
  232. {{ defaultData.fin_info.bank }} &emsp;<small
  233. >{{ $t("开户账号") }}:&nbsp;</small
  234. >
  235. {{ defaultData.fin_info.bankcardno }}
  236. </p>
  237. </div>
  238. </div>
  239. </div>
  240. <div style="flex: 1">
  241. <div class="mt-10">
  242. <p class="normal-title inline-16">{{ $t("收货信息") }}</p>
  243. </div>
  244. <div class="reveive__panel normal-margin">
  245. <div>
  246. <p class="inline-16">
  247. <b>{{ selectEnterpriseInfo.enterprisename }}</b>
  248. </p>
  249. <el-popover
  250. placement="bottom"
  251. :title="$t(`选择企业`)"
  252. trigger="click"
  253. v-model="visible4"
  254. >
  255. <div
  256. class="flex-align-center"
  257. style="justify-content: space-between; margin-bottom: 10px"
  258. >
  259. <el-input
  260. size="small"
  261. v-model="enterpriseParam.content.where.condition"
  262. :placeholder="$t('请输入搜索内容')"
  263. style="width: 150px"
  264. @keyup.enter.native="
  265. getEnterpriseList(
  266. (enterpriseParam.content.pageNumber = 1)
  267. )
  268. "
  269. @clear="
  270. getEnterpriseList(
  271. (enterpriseParam.content.pageNumber = 1)
  272. )
  273. "
  274. clearable
  275. ></el-input
  276. >&nbsp;
  277. </div>
  278. <el-table
  279. :data="enterpriseList"
  280. style="width: 100%"
  281. size="mini"
  282. >
  283. <el-table-column
  284. prop="enterprisename"
  285. :label="$t(`企业名称`)"
  286. width="150"
  287. >
  288. </el-table-column>
  289. <el-table-column :label="$t('地址')" width="360">
  290. <template slot-scope="scope">
  291. {{ scope.row.province }}{{ scope.row.city
  292. }}{{ scope.row.county }}{{ scope.row.address }}
  293. </template>
  294. </el-table-column>
  295. <el-table-column :label="$t('操作')" width="120">
  296. <template slot-scope="scope">
  297. <el-button
  298. class="inline-16"
  299. type="text"
  300. @click="
  301. (selectEnterpriseInfo = scope.row),
  302. (defaultData.re_info = {}),
  303. receiveAddress(),
  304. (visible4 = false)
  305. "
  306. size="mini"
  307. >{{ $t("选 择") }}</el-button
  308. >
  309. <!-- <delete-btn
  310. message="确定删除当前地址吗?"
  311. nameId="20221009155903"
  312. nameKey="contactsid"
  313. :id="scope.row.contactsid"
  314. :isNumber="true"
  315. @deleteSuccess="receiveAddress"
  316. ></delete-btn> -->
  317. </template>
  318. </el-table-column>
  319. </el-table>
  320. <div class="container" style="text-align: right">
  321. <el-pagination
  322. background
  323. small
  324. :current-page="enterpriseParam.content.pageNumber"
  325. @current-change="enterprisePageChange"
  326. :page-size="enterpriseParam.content.pageSize"
  327. layout="total,prev, pager, next"
  328. :total="enterpriseTotal"
  329. >
  330. </el-pagination>
  331. </div>
  332. <el-button slot="reference" type="text" size="mini">{{
  333. $t("选择企业")
  334. }}</el-button>
  335. </el-popover>
  336. </div>
  337. <div>
  338. <p class="inline-16">
  339. <span class="inline-16"
  340. ><b>{{ defaultData.re_info.name }}</b></span
  341. ><small>{{ defaultData.re_info.phonenumber }}</small>
  342. </p>
  343. <el-popover
  344. placement="bottom"
  345. :title="$t(`选择地址`)"
  346. trigger="click"
  347. v-model="visible"
  348. >
  349. <div
  350. class="flex-align-center"
  351. style="justify-content: space-between; margin-bottom: 10px"
  352. >
  353. <el-input
  354. size="small"
  355. v-model="addressparam.content.where.condition"
  356. :placeholder="$t('请输入搜索内容')"
  357. style="width: 150px"
  358. @keyup.enter.native="
  359. receiveAddress((addressparam.content.pageNumber = 1))
  360. "
  361. @clear="
  362. receiveAddress((addressparam.content.pageNumber = 1))
  363. "
  364. clearable
  365. ></el-input
  366. >&nbsp;
  367. <addAddressInfo
  368. style="text-align: right"
  369. @onAddSuccess="receiveAddress()"
  370. :mainData="{ sys_enterpriseid: data.sys_enterpriseid }"
  371. />
  372. </div>
  373. <el-table
  374. :data="receiveAddresslist"
  375. style="width: 100%"
  376. size="mini"
  377. >
  378. <el-table-column
  379. prop="name"
  380. :label="$t('联系人')"
  381. width="90"
  382. >
  383. </el-table-column>
  384. <el-table-column
  385. prop="phonenumber"
  386. :label="$t(`电话`)"
  387. width="120"
  388. >
  389. </el-table-column>
  390. <el-table-column :label="$t('地址')" width="360">
  391. <template slot-scope="scope">
  392. {{ scope.row.province }}{{ scope.row.city
  393. }}{{ scope.row.county }}{{ scope.row.address }}
  394. </template>
  395. </el-table-column>
  396. <el-table-column :label="$t('操作')" width="150">
  397. <template slot-scope="scope">
  398. <editAddressInfo
  399. class="inline-16"
  400. :mainData="{
  401. sys_enterpriseid: data.sys_enterpriseid,
  402. }"
  403. :row="scope.row"
  404. @onAddSuccess="receiveAddress()"
  405. ></editAddressInfo>
  406. <el-button
  407. class="inline-16"
  408. type="text"
  409. @click="
  410. (defaultData.re_info = scope.row), (visible = false)
  411. "
  412. size="mini"
  413. >{{ $t("选 择") }}</el-button
  414. >
  415. <delete-btn
  416. message="确定删除当前地址吗?"
  417. nameId="20221009155903"
  418. nameKey="contactsids"
  419. :id="scope.row.contactsid"
  420. :isNumber="false"
  421. @deleteSuccess="receiveAddress"
  422. ></delete-btn>
  423. </template>
  424. </el-table-column>
  425. </el-table>
  426. <div
  427. class="container"
  428. v-if="addresstotal"
  429. style="text-align: right"
  430. >
  431. <el-pagination
  432. background
  433. small
  434. :current-page="addressparam.content.pageNumber"
  435. @current-change="addresPageChange"
  436. :page-size="addressparam.content.pageSize"
  437. layout="total,prev, pager, next"
  438. :total="addresstotal"
  439. >
  440. </el-pagination>
  441. </div>
  442. <el-button slot="reference" type="text" size="mini">{{
  443. $t("选择其他地址")
  444. }}</el-button>
  445. </el-popover>
  446. </div>
  447. <small
  448. >{{
  449. defaultData.re_info.province
  450. ? defaultData.re_info.province
  451. : "--"
  452. }}{{ defaultData.re_info.city }}{{ defaultData.re_info.county
  453. }}{{
  454. defaultData.re_info.address ? defaultData.re_info.address : ""
  455. }}</small
  456. >
  457. </div>
  458. </div>
  459. </div>
  460. <div class="normal-margin flex-align-center">
  461. <div class="inline-16">
  462. <small
  463. ><b>{{ $t("回签单") }}</b
  464. >&nbsp;</small
  465. >
  466. <el-radio-group v-model="signbackstatus">
  467. <el-radio label="不需要">{{ $t("不需要") }}</el-radio>
  468. <el-radio label="纸质件">{{ $t("纸质件") }}</el-radio>
  469. <el-radio label="扫描件">{{ $t("扫描件") }}</el-radio>
  470. </el-radio-group>
  471. </div>
  472. <div style="margin-left: 20px">
  473. <small
  474. ><b>{{ $t("销售类别") }}:</b>&nbsp;</small
  475. >
  476. <el-select
  477. v-model="saletype"
  478. size="small"
  479. :placeholder="$t('请选择')"
  480. >
  481. <el-option
  482. v-for="item in saleroptions"
  483. :key="item.value"
  484. :label="$t(item.remarks)"
  485. :value="item.value"
  486. >
  487. </el-option>
  488. </el-select>
  489. </div>
  490. <div
  491. style="margin-left: 20px"
  492. v-if="
  493. siteId == 'HY' &&
  494. (data.type == '标准订单' || data.type == '项目订单')
  495. "
  496. >
  497. <small
  498. ><b>{{ $t("是否样品订单") }}:</b>&nbsp;</small
  499. >
  500. <el-radio-group v-model="data.typemx">
  501. <el-radio label="样品">{{ $t("是") }}</el-radio>
  502. <el-radio label="">{{ $t("否") }}</el-radio>
  503. </el-radio-group>
  504. </div>
  505. </div>
  506. <div class="mt-10" v-if="tool.checkAuth($route.name,'updShipping')">
  507. <p class="normal-title inline-16">{{$t(`运费方式`)}}</p>
  508. </div>
  509. <div class="mt-10 flex-align-center" v-if="tool.checkAuth($route.name,'updShipping')">
  510. <div :style="defaultData.freightstatus === '到付'?{background:'#d9ecff'}:{background:'#fff'}" class="reveive__panel normal-margin inline-16" @click="defaultData.freightstatus = '到付'">
  511. <p>{{$t(`到付`)}}</p>
  512. </div>
  513. <div :style="defaultData.freightstatus === '预付'?{background:'#d9ecff'}:{background:'#fff'}" class="reveive__panel normal-margin" @click="defaultData.freightstatus = '预付'">
  514. <p>{{$t(`预付`)}}</p>
  515. </div>
  516. </div>
  517. <div class="normal-margin">
  518. <p class="normal-title mt-10 inline-16">{{ $t("订单备注") }}</p>
  519. <el-input
  520. size="mini"
  521. class="order__note__input"
  522. type="textarea"
  523. v-model="defaultData.remarks"
  524. :autosize="{ minRows: 5 }"
  525. :placeholder="$t(`请输入订单备注`)"
  526. ></el-input>
  527. </div>
  528. <div
  529. class="normal-margin"
  530. v-if="data.type === '标准订单' || data.type === '特殊订单'"
  531. >
  532. <p class="normal-title mt-10 inline-16">{{ $t("项目备注") }}</p>
  533. <el-input
  534. size="mini"
  535. class="order__note__input"
  536. type="textarea"
  537. v-model="data.projectnote"
  538. :autosize="{ minRows: 5 }"
  539. :placeholder="$t(`请输入项目备注`)"
  540. ></el-input>
  541. </div>
  542. <div class="mt-10">
  543. <div>
  544. <p class="normal-title inline-16">{{ $t("订单产品") }}</p>
  545. <!-- <el-button type="text" size="mini" @click="addMoreProduct">{{setcol === 12?'关闭选择':'添加产品'}}</el-button> -->
  546. </div>
  547. <el-row :gutter="10">
  548. <el-col :span="setcol">
  549. <product-list
  550. ref="prolist"
  551. :data="data"
  552. :type="'edit'"
  553. @onSuccess="onEditSuccess"
  554. ></product-list>
  555. </el-col>
  556. <!-- <el-col :span="24 - setcol">
  557. <add-product ref="addpro" :data="data" @onConfirm="onConfirm"></add-product>
  558. </el-col> -->
  559. </el-row>
  560. </div>
  561. </div>
  562. <div class="fixed__btn__panel">
  563. <el-button
  564. size="small"
  565. @click="drawer = false"
  566. class="normal-btn-width"
  567. >{{ $t("取 消") }}</el-button
  568. >
  569. <el-button
  570. size="small"
  571. type="primary"
  572. @click="onSubmit"
  573. class="normal-btn-width"
  574. >{{ $t("保存修改") }}</el-button
  575. >
  576. </div>
  577. </el-drawer>
  578. </div>
  579. </template>
  580. <script>
  581. import previewImage from "@/components/previewImage/index.vue";
  582. import productList from "./productlist.vue";
  583. import addProduct from "@/template/orderCanUseProduct/index.vue";
  584. import financeEnterprise from "@/template/orderCanUseFinance/index.vue";
  585. import addAmountInfo from "@/components/financialInfo/modules/add";
  586. import addAddressInfo from "@/HManagement/marketing2/agent/details/modules/address/add";
  587. import editAddressInfo from "@/HManagement/marketing2/agent/details/modules/address/edit";
  588. export default {
  589. props: ["data"],
  590. components: {
  591. previewImage,
  592. productList,
  593. addProduct,
  594. financeEnterprise,
  595. addAmountInfo,
  596. addAddressInfo,
  597. editAddressInfo,
  598. },
  599. inject: ["thisDetail"],
  600. computed: {
  601. checkFreefreightamount() {
  602. let result = "";
  603. switch (this.freefreightamount) {
  604. case -1:
  605. result = this.$t("不免运费");
  606. break;
  607. case 0:
  608. result = this.$t("免运费");
  609. break;
  610. default:
  611. result =
  612. this.data.amount >= this.freefreightamount
  613. ? this.$t("当前订单免运费")
  614. : this.$t("订单满") +
  615. `${this.tool.formatAmount(this.freefreightamount, 2)}${this.$t(
  616. "元免运费,当前还差"
  617. )}${this.tool.formatAmount(
  618. this.freefreightamount - this.data.amount,
  619. 2
  620. )}${this.$t("元")}`;
  621. break;
  622. }
  623. return result;
  624. },
  625. },
  626. data() {
  627. return {
  628. siteId: JSON.parse(sessionStorage.getItem("active_account")).siteid,
  629. checked: 0,
  630. visible: false,
  631. visible1: false,
  632. visible2: false,
  633. visible3: false,
  634. visible4: false,
  635. drawer: false,
  636. receiveAddresslist: [],
  637. selectEnterpriseInfo: "",
  638. enterpriseList: [],
  639. accountlist: [],
  640. rebateAccount: [],
  641. logisticcomlist: [],
  642. financiallist: [],
  643. saleroptions: [],
  644. defaultData: {
  645. re_info: {},
  646. logist_info: {},
  647. fin_info: {},
  648. finance: {},
  649. accountclass: {},
  650. account_index: 0,
  651. remarks: this.data.remarks,
  652. freightstatus:''
  653. },
  654. total: 0,
  655. setcol: 24,
  656. rebateamount: null,
  657. isusedrebate: 0,
  658. signbackstatus: "不需要",
  659. saletype: "",
  660. freefreightamount: "",
  661. addressparam: {
  662. id: "20230220002602",
  663. content: {
  664. nocache: true,
  665. pageNumber: 1,
  666. pageSize: 10,
  667. sys_enterpriseid: "",
  668. where: {
  669. condition: "",
  670. workaddress: 1,
  671. },
  672. },
  673. },
  674. enterpriseParam: {
  675. id: 20230320134702,
  676. content: {
  677. pageNumber: 1,
  678. pageSize: 15,
  679. sys_enterpriseid: "",
  680. where: {
  681. condition: "",
  682. },
  683. },
  684. },
  685. addresstotal: 0,
  686. enterpriseTotal: 0,
  687. };
  688. },
  689. created() {
  690. this.queryBasicInfo();
  691. },
  692. methods: {
  693. enterprisePageChange(n) {
  694. this.enterpriseParam.content.pageNumber = n;
  695. this.getEnterpriseList();
  696. },
  697. addresPageChange(n) {
  698. this.addressparam.content.pageNumber = n;
  699. this.receiveAddress();
  700. },
  701. async queryBasicInfo() {
  702. const res = await this.$api.requested({
  703. id: 20220920084001,
  704. content: {
  705. sys_enterpriseid: this.data.sys_enterpriseid,
  706. },
  707. });
  708. this.freefreightamount = res.data.freefreightamount;
  709. },
  710. async rebateUsedChange() {
  711. console.log(this.data);
  712. if (this.data.status != "新建") return false;
  713. let amount = Math.round((this.data.order_rebate_userate * this.data.defaultamount)*100)/100; //最大可用金额
  714. let rebatebalance = this.data.rebatebalance; //返利金账户余额
  715. const res = await this.$api.requested({
  716. id: 20230218225002,
  717. content: {
  718. sa_orderid: this.data.sa_orderid, //订单金额
  719. isused: this.checked, //是否使用
  720. rebateamount: rebatebalance > amount ? amount : rebatebalance, //返利金使用金额
  721. },
  722. });
  723. if (res.code == 0){
  724. this.tool.showMessage(res,()=>{})
  725. }else {
  726. this.$emit("onSuccess");
  727. }
  728. // this.data.rebate_used = res.msg !== '成功' ? this.data.rebate_used == 0?1:0:this.data.rebate_used
  729. },
  730. onShow() {
  731. this.initPage();
  732. },
  733. async initPage() {
  734. this.setDefaultData();
  735. this.receiveAddress();
  736. this.getEnterpriseList();
  737. this.queryUsedrebate();
  738. this.selectOptions();
  739. this.checked = this.data.rebate_used;
  740. if (this.data.rebateamount > this.data.defaultamount) {
  741. this.rebateamount = this.tool.formatAmount(
  742. +this.data.defaultamount / 2
  743. );
  744. } else {
  745. this.rebateamount = this.data.rebateamount;
  746. }
  747. },
  748. /* 获取当前经销商企业列表 */
  749. async getEnterpriseList() {
  750. this.enterpriseParam.content.sys_enterpriseid =
  751. this.data.sys_enterpriseid;
  752. const res = await this.$api.requested(this.enterpriseParam);
  753. this.enterpriseList = res.data;
  754. this.enterpriseTotal = res.total;
  755. console.log(this.enterpriseList, "企业列表");
  756. },
  757. // 收货信息:合作企业联系人
  758. async receiveAddress(fn) {
  759. this.addressparam.content.sys_enterpriseid =
  760. this.selectEnterpriseInfo.sys_enterpriseid;
  761. const res = await this.$api.requested(this.addressparam);
  762. this.addresstotal = res.total;
  763. this.receiveAddresslist = res.data;
  764. },
  765. // 设置默认信息
  766. async setDefaultData() {
  767. this.defaultData.rebatebalance = this.data.rebatebalance;
  768. this.defaultData.finance = this.data.finance;
  769. this.defaultData.fin_info = this.data.finance;
  770. this.defaultData.accountclass = this.data.accountclass;
  771. this.defaultData.re_info = this.data.contacts;
  772. this.defaultData.freightstatus = this.data.freightstatus
  773. this.financiallist = this.data.pay_finance;
  774. this.saletype = this.data.saletype;
  775. this.signbackstatus = this.data.signbackstatus;
  776. this.selectEnterpriseInfo = this.data.contactsEnterprise;
  777. },
  778. async onSubmit() {
  779. const res = await this.$api.requested({
  780. id: 20221108111402,
  781. content: {
  782. sa_orderid: this.$route.query.id,
  783. sys_enterpriseid: this.data.sys_enterpriseid, //订货企业id
  784. sa_accountclassid: this.defaultData.accountclass.sa_accountclassid, //营销账户类型ID
  785. sa_brandid: this.data.sa_brandid, //品牌ID
  786. sa_contractid: this.data.sa_contractid, //合同ID,标准订单不传
  787. sa_projectid: this.data.sa_projectid, //工程项目表ID,标准订单不传
  788. sys_enterprise_financeid:
  789. this.defaultData.fin_info.sys_enterprise_financeid, //合作企业财务信息ID(开票信息)
  790. sa_logiscompid: this.defaultData.logist_info.sa_logiscompid, //物流公司档案ID
  791. rec_contactsid: this.defaultData.re_info.contactsid, //合作企业联系人表ID(收货信息)
  792. type: this.data.type, //订单类型
  793. typemx: this.data.typemx, //明细分类,可选
  794. remarks: this.defaultData.remarks, //可选
  795. saler_hrid: this.data.saler_hrid, //销售人员hrid,业务员hrid
  796. signbackstatus: this.signbackstatus,
  797. tradefieldmx: this.data.tradefieldmx,
  798. pay_enterpriseid: this.data.pay_enterpriseid,
  799. tradefield: this.data.tradefield,
  800. saletype: this.saletype,
  801. rebate_used: this.checked, //默认0,是否使用返利金
  802. signbacknum: "",
  803. sa_promotionid: this.data.sa_promotionid,
  804. billdate: this.data.billdate,
  805. projectnote: this.data.projectnote,
  806. freightstatus:this.defaultData.freightstatus
  807. },
  808. });
  809. this.tool.showMessage(res, () => {
  810. this.$emit("onSuccess");
  811. this.drawer = false
  812. /*if (this.data.type === '标准订单' || this.data.type === '特殊订单') {
  813. this.isusedrebate === 1?this.useRebate(this.data.rebateamount):""
  814. }*/
  815. });
  816. },
  817. onEditSuccess() {
  818. this.$refs.prolist.listData();
  819. this.$emit("onSuccess");
  820. },
  821. addMoreProduct() {
  822. this.setcol === 12 ? (this.setcol = 24) : (this.setcol = 12);
  823. },
  824. // 订单添加商品
  825. async onConfirm(data) {
  826. const res = await this.$api.requested({
  827. id: 20221109093602,
  828. content: {
  829. sa_orderid: this.$route.query.id, //订单ID
  830. sys_enterpriseid: this.data.sys_enterpriseid, //企业ID
  831. type: "标准订单", //订单类型
  832. items: data.map((e) => {
  833. return {
  834. sa_orderitemsid: 0,
  835. itemid: e.itemid,
  836. qty: e.orderminqty,
  837. needdate: e.deliverydate,
  838. };
  839. }),
  840. },
  841. });
  842. this.tool.showMessage(res, () => {
  843. this.setcol = 24;
  844. this.$refs["prolist"].listData();
  845. this.$emit("onSuccess");
  846. });
  847. },
  848. async useRebate(e) {
  849. let that = this;
  850. /* 修改返利金 */
  851. let rebateamount = e;
  852. let amount = Math.round((this.data.order_rebate_userate * this.data.defaultamount)*100)/100; //最大可用金额
  853. const res = await this.$api.requested({
  854. id: 20230218225002,
  855. content: {
  856. sa_orderid: this.data.sa_orderid, //订单金额
  857. isused: 1, //是否使用
  858. rebateamount: rebateamount > amount ? amount : rebateamount,
  859. },
  860. });
  861. if (res.msg=='成功') {
  862. this.$emit("onSuccess");
  863. this.initPage();
  864. if (rebateamount > amount) {
  865. this.data.rebateamount = amount;
  866. this.$message({
  867. message: this.$t("返利金最大可用值") + amount,
  868. type: "warning",
  869. });
  870. }
  871. } else {
  872. this.$message.success(res.msg);
  873. }
  874. },
  875. // 查询站点是否使用返利金
  876. async queryUsedrebate() {
  877. const res = await this.$api.requested({
  878. classname: "webmanage.site.site",
  879. method: "querySite_Parameter",
  880. content: {},
  881. });
  882. this.isusedrebate = res.data.order_rebate_used;
  883. },
  884. // 选择结算企业
  885. onSelect(data) {
  886. this.defaultData.finance = data;
  887. this.financiallist = data.finance;
  888. data.finance.forEach((e) => {
  889. if (e.isdefault === 1) {
  890. this.defaultData.fin_info = e;
  891. } else {
  892. this.defaultData.fin_info =
  893. data.finance.length > 0 ? data.finance[0] : {};
  894. }
  895. });
  896. },
  897. async selectOptions() {
  898. const res = await this.$store.dispatch("optiontypeselect", "saletype");
  899. this.saleroptions = res.data;
  900. },
  901. },
  902. };
  903. </script>
  904. <style>
  905. </style>
  906. <style scoped>
  907. .reveive__panel {
  908. font-size: 14px;
  909. line-height: 30px;
  910. padding: 10px;
  911. background: #d9ecff;
  912. border: 1px dashed #0676e7;
  913. }
  914. .account__panel small,
  915. .reveive__panel small {
  916. color: #666;
  917. }
  918. .account__panel {
  919. width: calc(25% - 26px);
  920. padding: 10px;
  921. margin-bottom: 10px;
  922. border: 1px dashed #666;
  923. }
  924. .act {
  925. background: #d9ecff;
  926. border: 1px dashed #0676e7;
  927. }
  928. .image {
  929. width: 40px;
  930. height: 40px;
  931. margin: 0px auto;
  932. }
  933. .order__note__input {
  934. border: none;
  935. outline: none;
  936. /* margin-left: 10px; */
  937. /* border-bottom: 1px solid #f1f2f3; */
  938. flex: 1;
  939. }
  940. </style>