detail.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829
  1. <template>
  2. <div>
  3. <el-card class="box-card">
  4. <div style="padding: 8px; text-align: center" v-if="formData.data.code || formData.data.wlnCode">
  5. <span style="font-size: 18px; font-weight: 700">{{ formData.data.code }} </span>
  6. <span style="font-size: 18px; font-weight: 700" v-if="formData.data.wlnCode"> ({{ formData.data.wlnCode }})</span>
  7. </div>
  8. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
  9. <template #deliveryAddress>
  10. <div style="width: 100%">
  11. <el-row>
  12. <el-col :span="3">
  13. <el-form-item label-width="0" prop="province" style="width: 100%">
  14. <el-input v-model="formData.data.province" placeholder="请输入省" />
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="3">
  18. <el-form-item label-width="0" prop="city" style="width: 100%">
  19. <el-input v-model="formData.data.city" placeholder="请输入市" />
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="3">
  23. <el-form-item label-width="0" prop="county" style="width: 100%">
  24. <el-input v-model="formData.data.county" placeholder="请输入区/县" />
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="11">
  28. <el-form-item label-width="0" prop="detailedAddress" style="width: 100%">
  29. <el-input v-model="formData.data.detailedAddress" placeholder="请输入详细地址" />
  30. </el-form-item>
  31. </el-col>
  32. <el-col :span="4">
  33. <el-form-item label-width="0" prop="postcode" style="width: 100%">
  34. <el-input v-model="formData.data.postcode" placeholder="请输入邮编" />
  35. </el-form-item>
  36. </el-col>
  37. </el-row>
  38. </div>
  39. </template>
  40. <template #consignee>
  41. <div style="width: 100%">
  42. <el-row>
  43. <el-col :span="6">
  44. <el-form-item label-width="0" prop="consignee" style="width: 100%">
  45. <el-input v-model="formData.data.consignee" placeholder="请输入联系人" />
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="6">
  49. <el-form-item label-width="0" prop="consigneeNumber" style="width: 100%">
  50. <el-input v-model="formData.data.consigneeNumber" placeholder="请输入联系电话" />
  51. </el-form-item>
  52. </el-col>
  53. <el-col :span="6">
  54. <el-form-item label-width="0" prop="departmentId" style="width: 100%">
  55. <el-select v-model="formData.data.departmentId" placeholder="请选择事业部" clearable style="width: 100%">
  56. <el-option v-for="item in departmentList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  57. </el-select>
  58. </el-form-item>
  59. </el-col>
  60. </el-row>
  61. </div>
  62. </template>
  63. <template #orderSkuList>
  64. <div style="width: 100%; padding: 0 20px">
  65. <el-collapse v-model="activeNames">
  66. <div v-for="(item, index) in formData.data.orderSkuList" :key="index" style="margin-bottom: 20px">
  67. <div style="border: 1px solid #edf0f5">
  68. <el-table :data="[item]" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
  69. <el-table-column label="产品" width="300">
  70. <template #default="{ row }">
  71. <div style="width: 100%">
  72. <div style="line-height: 35px">
  73. <span style="color: black; font-weight: 700">商品名称: </span>
  74. <span>{{ item.wlnSkuName }}</span>
  75. </div>
  76. <div style="line-height: 35px">
  77. <span style="color: black; font-weight: 700">品号: </span>
  78. <span>{{ item.code }}</span>
  79. </div>
  80. <div style="line-height: 35px; word-break: break-all">
  81. <span style="color: black; font-weight: 700">品名: </span>
  82. <span>{{ item.name }}</span>
  83. </div>
  84. <div style="line-height: 35px; display: flex">
  85. <span style="width: 37px; color: black; font-weight: 700">数量: </span>
  86. <el-form-item
  87. :prop="'orderSkuList.' + index + '.quantity'"
  88. :rules="rules.quantity"
  89. :inline-message="true"
  90. style="width: calc(100% - 37px)">
  91. <el-input-number
  92. onmousewheel="return false;"
  93. v-model="row.quantity"
  94. placeholder="数量"
  95. style="width: 100%"
  96. :controls="false"
  97. :min="0"
  98. :precision="0" />
  99. </el-form-item>
  100. </div>
  101. <div style="line-height: 35px">
  102. <span style="color: black; font-weight: 700">加工费: </span>
  103. <span>{{ item.customProcessingFee }}</span>
  104. <el-tooltip content="修改加工费" placement="top" effect="light">
  105. <el-icon
  106. style="margin-left: 10px; transform: translateY(2px); color: #409eff; cursor: pointer"
  107. @click="clickChangePrice(item, index, 'customProcessingFee', '加工费')"
  108. v-if="route.query && route.query.detailId">
  109. <EditPen />
  110. </el-icon>
  111. </el-tooltip>
  112. </div>
  113. <div style="line-height: 35px">
  114. <span style="color: black; font-weight: 700">代发费: </span>
  115. <span>{{ item.lssueFee }}</span>
  116. <el-tooltip content="修改代发费" placement="top" effect="light">
  117. <el-icon
  118. style="margin-left: 10px; transform: translateY(2px); color: #409eff; cursor: pointer"
  119. @click="clickChangePrice(item, index, 'lssueFee', '代发费')"
  120. v-if="route.query && route.query.detailId">
  121. <EditPen />
  122. </el-icon>
  123. </el-tooltip>
  124. </div>
  125. <div style="line-height: 35px">
  126. <span style="color: black; font-weight: 700">快递包材费: </span>
  127. <span>{{ item.deliveryMaterialsFee }}</span>
  128. <el-tooltip content="修改快递包材费" placement="top" effect="light">
  129. <el-icon
  130. style="margin-left: 10px; transform: translateY(2px); color: #409eff; cursor: pointer"
  131. @click="clickChangePrice(item, index, 'deliveryMaterialsFee', '快递包材费')"
  132. v-if="route.query && route.query.detailId">
  133. <EditPen />
  134. </el-icon>
  135. </el-tooltip>
  136. </div>
  137. <div style="line-height: 35px">
  138. <span style="color: black; font-weight: 700">包装人工费: </span>
  139. <span>{{ item.packingLabor }}</span>
  140. <el-tooltip content="修改包装人工费" placement="top" effect="light">
  141. <el-icon
  142. style="margin-left: 10px; transform: translateY(2px); color: #409eff; cursor: pointer"
  143. @click="clickChangePrice(item, index, 'packingLabor', '包装人工费')"
  144. v-if="route.query && route.query.detailId">
  145. <EditPen />
  146. </el-icon>
  147. </el-tooltip>
  148. </div>
  149. <div style="line-height: 35px">
  150. <span style="color: black; font-weight: 700">管理费: </span>
  151. <span>{{ item.managementFee }}</span>
  152. <el-tooltip content="修改管理费" placement="top" effect="light">
  153. <el-icon
  154. style="margin-left: 10px; transform: translateY(2px); color: #409eff; cursor: pointer"
  155. @click="clickChangePrice(item, index, 'managementFee', '管理费')"
  156. v-if="route.query && route.query.detailId">
  157. <EditPen />
  158. </el-icon>
  159. </el-tooltip>
  160. </div>
  161. <div style="line-height: 35px">
  162. <span style="color: black; font-weight: 700">单价: </span>
  163. <span>{{ item.unitPrice }}</span>
  164. <el-tooltip content="修改单价" placement="top" effect="light">
  165. <el-icon
  166. style="margin-left: 10px; transform: translateY(2px); color: #409eff; cursor: pointer"
  167. @click="clickChangePrice(item, index, 'unitPrice', '单价')"
  168. v-if="route.query && route.query.detailId">
  169. <EditPen />
  170. </el-icon>
  171. </el-tooltip>
  172. </div>
  173. <div style="line-height: 35px">
  174. <span style="color: black; font-weight: 700">小计: </span>
  175. <span>{{ getSubtotal(item) }}</span>
  176. </div>
  177. <div style="line-height: 35px">
  178. <span style="width: 37px; color: black; font-weight: 700">打印: </span>
  179. <el-form-item
  180. :prop="'orderSkuList.' + index + '.printType'"
  181. :rules="rules.printType"
  182. :inline-message="true"
  183. style="width: calc(100% - 37px)">
  184. <el-radio-group v-model="item.printType">
  185. <el-radio v-for="(itemType, index) in printType" :key="index" :label="itemType.dictKey">{{ itemType.dictValue }}</el-radio>
  186. </el-radio-group>
  187. </el-form-item>
  188. </div>
  189. </div>
  190. </template>
  191. </el-table-column>
  192. <el-table-column label="产品图稿" width="400">
  193. <template #default="{ row }">
  194. <el-form-item :prop="'orderSkuList.' + index + '.blueprint'">
  195. <div style="display: flex; width: 100%">
  196. <div style="width: 65px">设计图:</div>
  197. <div style="width: calc(100% - 65px)">
  198. <el-image
  199. fit="scale-down"
  200. style="width: 148px; height: 148px; margin-right: 10px"
  201. v-if="row.blueprint"
  202. :src="row.blueprint"
  203. @click="openFile(row.blueprint)" />
  204. </div>
  205. </div>
  206. <div style="display: flex; margin-top: 20px; width: 100%">
  207. <div style="width: 65px">图稿文件:</div>
  208. <div style="width: calc(100% - 65px)">
  209. <a
  210. style="color: #409eff; cursor: pointer; word-break: break-all; margin-right: 10px"
  211. @click="openFile(row.productionDocument)"
  212. v-if="row.productionDocument">
  213. {{ row.productionDocument }}
  214. </a>
  215. </div>
  216. </div>
  217. </el-form-item>
  218. </template>
  219. </el-table-column>
  220. <el-table-column label="包材配件/单品" min-width="400">
  221. <template #default="{ row }">
  222. <div style="width: 100%">
  223. <el-table :data="row.orderSkuBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
  224. <el-table-column label="单价¥" width="120">
  225. <template #default="props">
  226. <div>
  227. <span>{{ moneyFormat(props.row.unitPrice, 2) }}</span>
  228. <el-tooltip content="修改单价¥" placement="top" effect="light">
  229. <el-icon
  230. style="margin-left: 10px; transform: translateY(2px); color: #409eff; cursor: pointer"
  231. @click="clickChangeBomPrice(index, props.row, props.$index, 'unitPrice', '单价¥')"
  232. v-if="route.query && route.query.detailId">
  233. <EditPen />
  234. </el-icon>
  235. </el-tooltip>
  236. </div>
  237. </template>
  238. </el-table-column>
  239. <el-table-column label="数量" width="100">
  240. <template #default="props">
  241. <el-form-item
  242. :prop="'orderSkuList.' + index + '.orderSkuBomList.' + props.$index + '.quantity'"
  243. :rules="rules.quantity"
  244. :inline-message="true"
  245. style="width: 100%">
  246. <el-input-number
  247. onmousewheel="return false;"
  248. v-model="props.row.quantity"
  249. placeholder="数量"
  250. style="width: 100%"
  251. :controls="false"
  252. :min="0" />
  253. </el-form-item>
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="名称" prop="bomSpecName" min-width="150" />
  257. <el-table-column label="总量" width="80">
  258. <template #default="props">
  259. {{ computeQuantity(index, props.$index) }}
  260. </template>
  261. </el-table-column>
  262. <el-table-column label="小计¥" width="100">
  263. <template #default="props">
  264. {{ moneyFormat(computeMoney(index, props.$index), 2) }}
  265. </template>
  266. </el-table-column>
  267. </el-table>
  268. </div>
  269. </template>
  270. </el-table-column>
  271. </el-table>
  272. <el-collapse-item :name="index">
  273. <template #title>
  274. <span>包装</span>
  275. </template>
  276. <div style="display: flex; padding: 8px 10px 0px">
  277. <div style="flex: 1; padding: 0px 10px">
  278. <div>包装要求:</div>
  279. <div v-html="getStyle(item.packageRemark)"></div>
  280. </div>
  281. </div>
  282. </el-collapse-item>
  283. </div>
  284. </div>
  285. </el-collapse>
  286. </div>
  287. </template>
  288. <template #deliveryTime>
  289. <div style="width: 100%">
  290. <el-date-picker
  291. v-model="formData.data.deliveryTime"
  292. type="datetime"
  293. placeholder="请选择交货日期"
  294. value-format="YYYY-MM-DD HH:mm:ss"
  295. style="width: 100%" />
  296. </div>
  297. </template>
  298. <template #totalMonet>
  299. <div style="width: 100%; margin-left: 30px">
  300. <div>
  301. <span style="font-weight: 700; color: #6c88f1">产品总金额: ¥{{ moneyFormat(calculatedAmount("unitPrice"), 2) }}</span>
  302. <span style="font-weight: 700; color: #6c88f1; margin-left: 40px">
  303. 定制加工费: ¥{{ moneyFormat(calculatedAmount("customProcessingFee"), 2) }}
  304. </span>
  305. <span style="font-weight: 700; color: #6c88f1; margin-left: 40px">代发费: ¥{{ moneyFormat(calculatedAmount("lssueFee"), 2) }}</span>
  306. <span style="font-weight: 700; color: #6c88f1; margin-left: 40px">
  307. 快递包材费: ¥{{ moneyFormat(calculatedAmount("deliveryMaterialsFee"), 2) }}
  308. </span>
  309. <span style="font-weight: 700; color: #6c88f1; margin-left: 40px">包装人工费: ¥{{ moneyFormat(calculatedAmount("packingLabor"), 2) }}</span>
  310. <span style="font-weight: 700; color: #6c88f1; margin-left: 40px">包材费: ¥{{ moneyFormat(calculatedPackagingMaterialCost(), 2) }}</span>
  311. <span style="font-weight: 700; color: #6c88f1; margin-left: 40px">管理费: ¥{{ moneyFormat(calculatedAmount("managementFee"), 2) }}</span>
  312. </div>
  313. <div style="padding: 8px 0 0 0">
  314. <span style="font-weight: 700; color: red">订单总金额(含税): ¥{{ moneyFormat(calculatedTotalAmount(), 2) }}</span>
  315. </div>
  316. </div>
  317. </template>
  318. <template #remark>
  319. <div style="width: 100%">
  320. <div v-html="getStyle(formData.data.remark)"></div>
  321. </div>
  322. </template>
  323. </byForm>
  324. <div style="text-align: center; margin: 10px">
  325. <el-button @click="clickCancel()" size="large">关 闭</el-button>
  326. </div>
  327. </el-card>
  328. <el-dialog :title="'修改' + textPrice" v-if="openChangePrice" v-model="openChangePrice" width="500">
  329. <el-form :model="changePrice.data" label-width="120px" ref="price">
  330. <el-form-item
  331. label="定制加工类型"
  332. prop="customProcessingType"
  333. :rules="[{ required: true, message: '请选择定制加工类型', trigger: 'change' }]"
  334. v-if="labelPrice === 'customProcessingFee'">
  335. <el-select
  336. v-model="changePrice.data.customProcessingType"
  337. placeholder="请选择定制加工类型"
  338. style="width: 100%"
  339. clearable
  340. @change="changeProcessingType">
  341. <el-option :label="'无'" :value="'-1'" />
  342. <el-option
  343. v-for="itemDict in useUserStore().allDict['processing_layout']"
  344. :key="itemDict.dictKey"
  345. :label="itemDict.dictValue"
  346. :value="itemDict.dictKey" />
  347. </el-select>
  348. </el-form-item>
  349. <el-form-item :label="textPrice" :prop="labelPrice" :rules="[{ required: true, message: '请输入' + textPrice, trigger: 'blur' }]">
  350. <el-input-number
  351. onmousewheel="return false;"
  352. v-model="changePrice.data[labelPrice]"
  353. :placeholder="textPrice"
  354. style="width: 100%"
  355. :controls="false"
  356. :min="0"
  357. :precision="2"
  358. :disabled="(!changePrice.data.customProcessingType || changePrice.data.customProcessingType === '-1') && labelPrice === 'customProcessingFee'" />
  359. </el-form-item>
  360. </el-form>
  361. <template #footer>
  362. <el-button @click="openChangePrice = false" size="large">取 消</el-button>
  363. <el-button type="primary" @click="submitChangePrice()" size="large" v-preReClick>确 定</el-button>
  364. </template>
  365. </el-dialog>
  366. </div>
  367. </template>
  368. <script setup>
  369. import byForm from "/src/components/byForm/index";
  370. import { ElMessage } from "element-plus";
  371. import { useRouter, useRoute } from "vue-router";
  372. import useTagsViewStore from "/src/store/modules/tagsView";
  373. const { proxy } = getCurrentInstance();
  374. const router = useRouter();
  375. const route = useRoute();
  376. const submit = ref(null);
  377. const departmentList = ref([]);
  378. const activeNames = ref([]);
  379. const formOption = reactive({
  380. inline: true,
  381. labelWidth: "120px",
  382. itemWidth: 100,
  383. rules: [],
  384. labelPosition: "right",
  385. });
  386. const formData = reactive({
  387. data: {
  388. remark: "",
  389. orderSkuList: [],
  390. },
  391. });
  392. const formConfig = computed(() => {
  393. return [
  394. {
  395. type: "title",
  396. title: "产品",
  397. label: "",
  398. },
  399. {
  400. type: "slot",
  401. prop: "orderSkuList",
  402. slotName: "orderSkuList",
  403. },
  404. route.query && route.query.detailId
  405. ? {}
  406. : {
  407. type: "title",
  408. title: "地址",
  409. label: "",
  410. },
  411. route.query && route.query.detailId
  412. ? {}
  413. : {
  414. type: "slot",
  415. slotName: "deliveryAddress",
  416. label: "收货地址",
  417. },
  418. route.query && route.query.detailId
  419. ? {}
  420. : {
  421. type: "slot",
  422. slotName: "consignee",
  423. label: "收货人",
  424. },
  425. {
  426. type: "title",
  427. title: "贸易",
  428. label: "",
  429. },
  430. {
  431. type: "slot",
  432. prop: "deliveryTime",
  433. slotName: "deliveryTime",
  434. label: "交货时间",
  435. itemWidth: 25,
  436. },
  437. {
  438. type: "select",
  439. label: "选择快递",
  440. prop: "expressDeliveryId",
  441. data: [],
  442. itemWidth: 25,
  443. clearable: true,
  444. },
  445. {
  446. type: "select",
  447. label: "店铺来源",
  448. prop: "sourcePlatform",
  449. data: proxy.useUserStore().allDict["source_platform"],
  450. itemWidth: 25,
  451. clearable: true,
  452. },
  453. {
  454. type: "select",
  455. label: "店铺名称",
  456. prop: "shopName",
  457. data: proxy.useUserStore().allDict["shop_name"],
  458. itemWidth: 25,
  459. clearable: true,
  460. },
  461. {
  462. type: "title",
  463. title: "总计",
  464. label: "",
  465. },
  466. {
  467. type: "slot",
  468. prop: "totalMonet",
  469. slotName: "totalMonet",
  470. },
  471. {
  472. type: "title",
  473. title: "订单备注",
  474. label: "",
  475. },
  476. {
  477. type: "slot",
  478. slotName: "remark",
  479. },
  480. ];
  481. });
  482. const rules = ref({
  483. province: [{ required: true, message: "请输入省", trigger: "blur" }],
  484. detailedAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
  485. consignee: [{ required: true, message: "请输入联系人", trigger: "blur" }],
  486. consigneeNumber: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
  487. deliveryTime: [{ required: true, message: "请选择交货时间", trigger: "change" }],
  488. // expressDeliveryId: [{ required: true, message: "请选择快递", trigger: "change" }],
  489. commercePlatform: [{ required: true, message: "请选择电商平台", trigger: "change" }],
  490. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  491. });
  492. const getDemandData = () => {
  493. proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  494. if (res.rows && res.rows.length > 0) {
  495. departmentList.value = res.rows.map((item) => {
  496. return {
  497. dictKey: item.id,
  498. dictValue: item.name,
  499. };
  500. });
  501. }
  502. });
  503. };
  504. getDemandData();
  505. const openFile = (path) => {
  506. window.open(path);
  507. };
  508. const clickCancel = () => {
  509. const useTagsStore = useTagsViewStore();
  510. useTagsStore.delVisitedView(router.currentRoute.value);
  511. if (route.query && route.query.orderInquiry) {
  512. router.replace({
  513. path: "/production/schedule/order-inquiry",
  514. });
  515. } else {
  516. router.replace({
  517. path: "/group/order/order-management",
  518. });
  519. }
  520. };
  521. onMounted(() => {
  522. if (route.query && (route.query.id || route.query.detailId)) {
  523. useTagsViewStore().visitedViews = useTagsViewStore().visitedViews.map((item) => {
  524. if (item.query && item.query.random === route.query.random) {
  525. return {
  526. ...item,
  527. name: route.query.text,
  528. title: route.query.text,
  529. };
  530. } else {
  531. return {
  532. ...item,
  533. };
  534. }
  535. });
  536. getOrderDetail({ id: route.query.id || route.query.detailId });
  537. }
  538. });
  539. const getOrderDetail = (parameter) => {
  540. proxy.post("/orderInfo/detail", parameter).then((res) => {
  541. formData.data = res;
  542. if (route.query.id) {
  543. proxy.$refs.editor.changeHtml(formData.data.remark);
  544. }
  545. if (route.query.detailId) {
  546. let allIndex = [];
  547. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  548. allIndex.push(i);
  549. }
  550. activeNames.value = allIndex;
  551. formOption.disabled = true;
  552. }
  553. });
  554. };
  555. const getStyle = (text) => {
  556. if (text) {
  557. return text.replace(/\n|\r\n/g, "<br>");
  558. } else {
  559. return "";
  560. }
  561. };
  562. const printType = ref([
  563. {
  564. dictKey: 1,
  565. dictValue: "单面",
  566. },
  567. {
  568. dictKey: 2,
  569. dictValue: "双面",
  570. },
  571. ]);
  572. const changePrice = reactive({
  573. data: {},
  574. });
  575. const openChangePrice = ref(false);
  576. const productIndex = ref(0);
  577. const productIndexBOM = ref(0);
  578. const labelPrice = ref("");
  579. const textPrice = ref("");
  580. const clickChangePrice = (item, index, label, text) => {
  581. changePrice.data = {
  582. customProcessingFee: item.customProcessingFee,
  583. lssueFee: item.lssueFee,
  584. deliveryMaterialsFee: item.deliveryMaterialsFee,
  585. packingLabor: item.packingLabor,
  586. managementFee: item.managementFee,
  587. unitPrice: item.unitPrice,
  588. customProcessingType: item.customProcessingType,
  589. };
  590. productIndex.value = index;
  591. productIndexBOM.value = null;
  592. labelPrice.value = label;
  593. textPrice.value = text;
  594. openChangePrice.value = true;
  595. };
  596. const submitChangePrice = () => {
  597. proxy.$refs.price.validate((valid) => {
  598. if (valid) {
  599. if (productIndexBOM.value === null) {
  600. formData.data.orderSkuList[productIndex.value][labelPrice.value] = changePrice.data[labelPrice.value];
  601. if (labelPrice.value === "customProcessingFee") {
  602. formData.data.orderSkuList[productIndex.value].customProcessingType = changePrice.data.customProcessingType;
  603. }
  604. if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
  605. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  606. let packagingMaterialCost = 0;
  607. if (formData.data.orderSkuList[i].quantity) {
  608. if (formData.data.orderSkuList[i].orderSkuBomList && formData.data.orderSkuList[i].orderSkuBomList.length > 0) {
  609. for (let j = 0; j < formData.data.orderSkuList[i].orderSkuBomList.length; j++) {
  610. if (formData.data.orderSkuList[i].orderSkuBomList[j].quantity && formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) {
  611. packagingMaterialCost = Number(
  612. Math.round(
  613. (packagingMaterialCost +
  614. formData.data.orderSkuList[i].orderSkuBomList[j].quantity * formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) *
  615. 100
  616. ) / 100
  617. );
  618. }
  619. }
  620. }
  621. }
  622. formData.data.orderSkuList[i].packagingMaterialCost = packagingMaterialCost;
  623. }
  624. }
  625. formData.data.productTotalAmount = calculatedAmount("unitPrice");
  626. formData.data.customProcessingFee = calculatedAmount("customProcessingFee");
  627. formData.data.lssueFee = calculatedAmount("lssueFee");
  628. formData.data.deliveryMaterialsFee = calculatedAmount("deliveryMaterialsFee");
  629. formData.data.packingLabor = calculatedAmount("packingLabor");
  630. formData.data.managementFee = calculatedAmount("managementFee");
  631. formData.data.packagingMaterialCost = calculatedPackagingMaterialCost();
  632. formData.data.totalAmount = calculatedTotalAmount();
  633. proxy.post("/orderInfo/edit", formData.data).then(() => {
  634. ElMessage({ message: "修改完成", type: "success" });
  635. openChangePrice.value = false;
  636. getOrderDetail({ id: route.query.id || route.query.detailId });
  637. });
  638. } else {
  639. formData.data.orderSkuList[productIndex.value].orderSkuBomList[productIndexBOM.value][labelPrice.value] = changePrice.data[labelPrice.value];
  640. if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
  641. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  642. let packagingMaterialCost = 0;
  643. if (formData.data.orderSkuList[i].quantity) {
  644. if (formData.data.orderSkuList[i].orderSkuBomList && formData.data.orderSkuList[i].orderSkuBomList.length > 0) {
  645. for (let j = 0; j < formData.data.orderSkuList[i].orderSkuBomList.length; j++) {
  646. if (formData.data.orderSkuList[i].orderSkuBomList[j].quantity && formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) {
  647. packagingMaterialCost = Number(
  648. Math.round(
  649. (packagingMaterialCost +
  650. formData.data.orderSkuList[i].orderSkuBomList[j].quantity * formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) *
  651. 100
  652. ) / 100
  653. );
  654. }
  655. }
  656. }
  657. }
  658. formData.data.orderSkuList[i].packagingMaterialCost = packagingMaterialCost;
  659. }
  660. }
  661. formData.data.productTotalAmount = calculatedAmount("unitPrice");
  662. formData.data.customProcessingFee = calculatedAmount("customProcessingFee");
  663. formData.data.lssueFee = calculatedAmount("lssueFee");
  664. formData.data.deliveryMaterialsFee = calculatedAmount("deliveryMaterialsFee");
  665. formData.data.packingLabor = calculatedAmount("packingLabor");
  666. formData.data.managementFee = calculatedAmount("managementFee");
  667. formData.data.packagingMaterialCost = calculatedPackagingMaterialCost();
  668. formData.data.totalAmount = calculatedTotalAmount();
  669. proxy.post("/orderInfo/edit", formData.data).then(() => {
  670. ElMessage({ message: "修改完成", type: "success" });
  671. openChangePrice.value = false;
  672. getOrderDetail({ id: route.query.id || route.query.detailId });
  673. });
  674. }
  675. }
  676. });
  677. };
  678. const clickChangeBomPrice = (index, item, indexBOM, label, text) => {
  679. changePrice.data = {
  680. unitPrice: item.unitPrice,
  681. };
  682. productIndex.value = index;
  683. productIndexBOM.value = indexBOM;
  684. labelPrice.value = label;
  685. textPrice.value = text;
  686. openChangePrice.value = true;
  687. };
  688. const changeProcessingType = () => {
  689. changePrice.data[labelPrice.value] = 0;
  690. };
  691. const computeQuantity = (index, indexSKU) => {
  692. let quantity = 0;
  693. if (formData.data.orderSkuList[index].quantity && formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity) {
  694. quantity = Number(
  695. Math.round(formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity * formData.data.orderSkuList[index].quantity * 100) / 100
  696. );
  697. }
  698. return quantity;
  699. };
  700. const computeMoney = (index, indexSKU) => {
  701. let money = 0;
  702. if (
  703. formData.data.orderSkuList[index].quantity &&
  704. formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity &&
  705. formData.data.orderSkuList[index].orderSkuBomList[indexSKU].unitPrice
  706. ) {
  707. money = Number(
  708. Math.round(
  709. formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity *
  710. formData.data.orderSkuList[index].orderSkuBomList[indexSKU].unitPrice *
  711. formData.data.orderSkuList[index].quantity *
  712. 100
  713. ) / 100
  714. );
  715. }
  716. return money;
  717. };
  718. const getSubtotal = (item) => {
  719. let money = 0;
  720. if (item.quantity) {
  721. money = Number(
  722. Math.round(
  723. (item.customProcessingFee + item.deliveryMaterialsFee + item.lssueFee + item.packingLabor + item.managementFee + item.unitPrice) * item.quantity * 100
  724. ) / 100
  725. );
  726. }
  727. return money;
  728. };
  729. const calculatedAmount = (label) => {
  730. let money = 0;
  731. if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
  732. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  733. if (formData.data.orderSkuList[i].quantity && formData.data.orderSkuList[i][label]) {
  734. money = Number(Math.round((money + formData.data.orderSkuList[i][label] * formData.data.orderSkuList[i].quantity) * 100) / 100);
  735. }
  736. }
  737. }
  738. return money;
  739. };
  740. const calculatedPackagingMaterialCost = () => {
  741. let money = 0;
  742. if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
  743. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  744. if (formData.data.orderSkuList[i].orderSkuBomList && formData.data.orderSkuList[i].orderSkuBomList.length > 0) {
  745. for (let j = 0; j < formData.data.orderSkuList[i].orderSkuBomList.length; j++) {
  746. if (formData.data.orderSkuList[i].orderSkuBomList[j].quantity && formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) {
  747. money = Number(
  748. Math.round(
  749. (money +
  750. formData.data.orderSkuList[i].orderSkuBomList[j].quantity *
  751. formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice *
  752. formData.data.orderSkuList[i].quantity) *
  753. 100
  754. ) / 100
  755. );
  756. }
  757. }
  758. }
  759. }
  760. }
  761. return money;
  762. };
  763. const calculatedTotalAmount = () => {
  764. let money = 0;
  765. money = Number(
  766. Math.round(
  767. (calculatedAmount("unitPrice") +
  768. calculatedAmount("customProcessingFee") +
  769. calculatedAmount("lssueFee") +
  770. calculatedAmount("deliveryMaterialsFee") +
  771. calculatedAmount("packingLabor") +
  772. calculatedAmount("managementFee") +
  773. calculatedPackagingMaterialCost()) *
  774. 100
  775. ) / 100
  776. );
  777. return money;
  778. };
  779. </script>
  780. <style lang="scss" scoped>
  781. ::v-deep(.el-input-number .el-input__inner) {
  782. text-align: left;
  783. }
  784. :deep(.el-dialog) {
  785. margin-top: 10px !important;
  786. margin-bottom: 10px !important;
  787. }
  788. :deep(.ql-editor) {
  789. height: auto;
  790. }
  791. :deep(.el-collapse-item__header) {
  792. justify-content: center;
  793. }
  794. :deep(.el-collapse-item__arrow) {
  795. margin: 0;
  796. }
  797. .avatar-uploader .avatar {
  798. width: 148px;
  799. height: 148px;
  800. display: block;
  801. background-color: black;
  802. }
  803. .avatar-uploader .el-upload {
  804. border: 1px dashed var(--el-border-color);
  805. border-radius: 6px;
  806. cursor: pointer;
  807. position: relative;
  808. overflow: hidden;
  809. transition: var(--el-transition-duration-fast);
  810. }
  811. .avatar-uploader .el-upload:hover {
  812. border-color: var(--el-color-primary);
  813. }
  814. .el-icon.avatar-uploader-icon {
  815. font-size: 28px;
  816. color: #8c939d;
  817. width: 148px;
  818. height: 148px;
  819. text-align: center;
  820. border: 1px dashed var(--el-border-color);
  821. }
  822. :deep(.el-table__cell) {
  823. vertical-align: top;
  824. }
  825. </style>