edit.vue 38 KB

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