order.vue 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259
  1. <template>
  2. <div>
  3. <div style="padding: 8px; text-align: center" v-if="formData.data.code || formData.data.wlnCode">
  4. <span style="font-size: 18px; font-weight: 700">{{ formData.data.code }} </span>
  5. <span style="font-size: 18px; font-weight: 700" v-if="formData.data.wlnCode"> ({{ formData.data.wlnCode }})</span>
  6. </div>
  7. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
  8. <template #type>
  9. <div style="width: 100%">
  10. <el-radio-group v-model="formData.data.type">
  11. <el-radio v-for="(itemType, index) in typeList" :key="index" :label="itemType.dictKey">{{ itemType.dictValue }}</el-radio>
  12. </el-radio-group>
  13. </div>
  14. </template>
  15. <template #departmentId>
  16. <div style="width: 100%">
  17. <el-select v-model="formData.data.departmentId" placeholder="请选择事业部" clearable style="width: 100%">
  18. <el-option v-for="item in departmentList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  19. </el-select>
  20. </div>
  21. </template>
  22. <template #deliveryAddress>
  23. <div style="width: 100%">
  24. <el-row>
  25. <el-col :span="3">
  26. <el-form-item label-width="0" prop="province" style="width: 100%">
  27. <el-input v-model="formData.data.province" placeholder="请输入省" />
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="3">
  31. <el-form-item label-width="0" prop="city" style="width: 100%">
  32. <el-input v-model="formData.data.city" placeholder="请输入市" />
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="3">
  36. <el-form-item label-width="0" prop="county" style="width: 100%">
  37. <el-input v-model="formData.data.county" placeholder="请输入区/县" />
  38. </el-form-item>
  39. </el-col>
  40. <el-col :span="11">
  41. <el-form-item label-width="0" prop="detailedAddress" style="width: 100%">
  42. <el-input v-model="formData.data.detailedAddress" placeholder="请输入详细地址" />
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="4">
  46. <el-form-item label-width="0" prop="postcode" style="width: 100%">
  47. <el-input v-model="formData.data.postcode" placeholder="请输入邮编" />
  48. </el-form-item>
  49. </el-col>
  50. </el-row>
  51. </div>
  52. </template>
  53. <template #consignee>
  54. <div style="width: 100%">
  55. <el-row>
  56. <el-col :span="6">
  57. <el-form-item label-width="0" prop="consignee" style="width: 100%">
  58. <el-input v-model="formData.data.consignee" placeholder="请输入联系人" />
  59. </el-form-item>
  60. </el-col>
  61. <el-col :span="6">
  62. <el-form-item label-width="0" prop="consigneeNumber" style="width: 100%">
  63. <el-input v-model="formData.data.consigneeNumber" placeholder="请输入联系电话" />
  64. </el-form-item>
  65. </el-col>
  66. </el-row>
  67. </div>
  68. </template>
  69. <template #orderSkuList>
  70. <div style="width: 100%; padding: 0 20px">
  71. <div style="margin-bottom: 10px" v-if="!formOption.disabled">
  72. <el-button type="primary" size="small" @click="clickAddProduct()">选择产品</el-button>
  73. <el-button type="primary" size="small" @click="clickUploadProduct()">导入产品</el-button>
  74. </div>
  75. <el-collapse v-model="activeNames">
  76. <div v-for="(item, index) in formData.data.orderSkuList" :key="index" style="margin-bottom: 20px">
  77. <div style="border: 1px solid #edf0f5">
  78. <el-table :data="[item]" :row-style="{ height: '35px' }" header-row-class-name="tableHeader" :cell-class-name="cellStyleName">
  79. <el-table-column label="产品" width="300">
  80. <template #default="{ row }">
  81. <div style="width: 100%">
  82. <div style="line-height: 35px" v-if="!(route.query && route.query.detailId)">
  83. <span style="color: black; font-weight: 700">库存数量: </span>
  84. <span>{{ item.inventoryQuantity }}</span>
  85. </div>
  86. <div style="line-height: 35px">
  87. <span style="color: black; font-weight: 700">商品名称: </span>
  88. <span>{{ item.wlnSkuName }}</span>
  89. </div>
  90. <div style="line-height: 35px">
  91. <span style="color: black; font-weight: 700">品号: </span>
  92. <span>{{ item.code }}</span>
  93. </div>
  94. <div style="line-height: 35px; word-break: break-all">
  95. <span style="color: black; font-weight: 700">品名: </span>
  96. <span>{{ item.name }}</span>
  97. </div>
  98. <div style="line-height: 35px; display: flex">
  99. <span style="width: 90px; color: black; font-weight: 700">E10成品品号: </span>
  100. <el-form-item
  101. :prop="'orderSkuList.' + index + '.erpCode'"
  102. :rules="rules.erpCode"
  103. :inline-message="true"
  104. style="width: calc(100% - 90px)">
  105. <el-input v-model="row.erpCode" placeholder="请输入E10成品品号" style="width: 100%" />
  106. </el-form-item>
  107. </div>
  108. <div style="line-height: 35px; display: flex">
  109. <span style="width: 52px; color: black; font-weight: 700">特征码: </span>
  110. <el-form-item
  111. :prop="'orderSkuList.' + index + '.featureCode'"
  112. :rules="rules.featureCode"
  113. :inline-message="true"
  114. style="width: calc(100% - 52px)">
  115. <el-input v-model="row.featureCode" placeholder="请输入特征码" style="width: 100%" />
  116. </el-form-item>
  117. </div>
  118. <div style="line-height: 35px; display: flex">
  119. <span style="width: 37px; color: black; font-weight: 700">数量: </span>
  120. <el-form-item
  121. :prop="'orderSkuList.' + index + '.quantity'"
  122. :rules="rules.quantity"
  123. :inline-message="true"
  124. style="width: calc(100% - 37px)">
  125. <el-input-number
  126. onmousewheel="return false;"
  127. v-model="row.quantity"
  128. placeholder="数量"
  129. style="width: 100%"
  130. :controls="false"
  131. :min="0"
  132. :precision="0"
  133. @change="changeQuantity(index, true)" />
  134. </el-form-item>
  135. </div>
  136. <div style="line-height: 35px">
  137. <span style="color: black; font-weight: 700">加工费: </span>
  138. <span>{{ item.customProcessingFee }}</span>
  139. </div>
  140. <div style="line-height: 35px">
  141. <span style="color: black; font-weight: 700">代发费: </span>
  142. <span>{{ item.lssueFee }}</span>
  143. </div>
  144. <div style="line-height: 35px">
  145. <span style="color: black; font-weight: 700">快递包材费: </span>
  146. <span>{{ computeSingleDeliveryMaterialsFee(index) }}</span>
  147. </div>
  148. <div style="line-height: 35px">
  149. <span style="color: black; font-weight: 700">包装人工费: </span>
  150. <span>{{ item.packingLabor }}</span>
  151. </div>
  152. <div style="line-height: 35px">
  153. <span style="color: black; font-weight: 700">管理费: </span>
  154. <span>{{ item.managementFee }}</span>
  155. </div>
  156. <div style="line-height: 35px">
  157. <span style="color: black; font-weight: 700">单价: </span>
  158. <span>{{ item.unitPrice }}</span>
  159. </div>
  160. <div style="line-height: 35px">
  161. <span style="color: black; font-weight: 700">小计: </span>
  162. <span>{{ getSubtotal(item) }}</span>
  163. </div>
  164. <div style="line-height: 35px">
  165. <span style="width: 37px; color: black; font-weight: 700">打印: </span>
  166. <el-form-item
  167. :prop="'orderSkuList.' + index + '.printType'"
  168. :rules="rules.printType"
  169. :inline-message="true"
  170. style="width: calc(100% - 37px)">
  171. <el-radio-group v-model="item.printType" @change="changeQuantity(index)">
  172. <el-radio v-for="(itemType, index) in printType" :key="index" :label="itemType.dictKey">{{ itemType.dictValue }}</el-radio>
  173. </el-radio-group>
  174. </el-form-item>
  175. </div>
  176. </div>
  177. </template>
  178. </el-table-column>
  179. <el-table-column label="产品图稿" width="400">
  180. <template #default="{ row }">
  181. <div style="display: flex; width: 100%">
  182. <div style="width: 80px">设计图:</div>
  183. <div style="width: calc(100% - 80px)">
  184. <el-image
  185. fit="scale-down"
  186. style="width: 148px; height: 148px; margin-right: 10px; cursor: pointer"
  187. v-if="row.blueprint"
  188. :src="row.blueprint"
  189. @click="openFile(row.blueprint)" />
  190. <div style="display: flex" v-if="!(route.query && route.query.detailId)">
  191. <el-button type="primary" @click="clickDrawingFile(index)" text>选择图稿</el-button>
  192. <el-upload
  193. :show-file-list="false"
  194. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  195. :data="uploadImgData"
  196. :before-upload="uploadImgFile"
  197. :on-success="
  198. (response, uploadFile) => {
  199. return handleImgSuccess(uploadFile, index);
  200. }
  201. "
  202. style="width: 100%"
  203. accept=".jpg,.jpeg,.png,.GIF,.JPG,.PNG">
  204. <el-button type="primary" style="margin-left: 12px" text>上传图片</el-button>
  205. </el-upload>
  206. </div>
  207. </div>
  208. </div>
  209. <div style="display: flex; margin-top: 20px; width: 100%">
  210. <div style="width: 80px">图稿文件:</div>
  211. <div style="width: calc(100% - 80px)">
  212. <a
  213. style="color: #409eff; cursor: pointer; word-break: break-all; margin-right: 10px"
  214. @click="openFile(row.productionDocument)"
  215. v-if="row.productionDocument">
  216. {{ row.productionDocument }}
  217. </a>
  218. <div style="display: flex" v-if="!(route.query && route.query.detailId)">
  219. <el-button type="primary" @click="clickDrawingFile(index)" text>选择图稿</el-button>
  220. <el-upload
  221. :show-file-list="false"
  222. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  223. :data="uploadData"
  224. :before-upload="uploadFile"
  225. :on-success="
  226. (response, uploadFile) => {
  227. return handleSuccess(uploadFile, index);
  228. }
  229. "
  230. style="width: 100%">
  231. <el-button type="primary" style="margin-left: 12px" text>上传文件</el-button>
  232. </el-upload>
  233. </div>
  234. </div>
  235. </div>
  236. <div style="font-weight: 700; margin-top: 20px">产品不干胶图稿</div>
  237. <div style="display: flex; width: 100%">
  238. <div style="width: 80px">不干胶图片:</div>
  239. <div style="width: calc(100% - 80px)">
  240. <el-image
  241. fit="scale-down"
  242. style="width: 148px; height: 148px; margin-right: 10px; cursor: pointer"
  243. v-if="row.selfAdhesiveStickerFile && row.selfAdhesiveStickerFile.fileUrl"
  244. :src="row.selfAdhesiveStickerFile.fileUrl"
  245. @click="openFile(row.selfAdhesiveStickerFile.fileUrl)" />
  246. <div style="display: flex" v-if="!(route.query && route.query.detailId)">
  247. <el-upload
  248. :show-file-list="false"
  249. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  250. :data="uploadAdhesiveData"
  251. :before-upload="uploadAdhesiveFile"
  252. :on-success="
  253. (response, uploadFile) => {
  254. return handleAdhesiveSuccess(uploadFile, index);
  255. }
  256. "
  257. style="width: 100%"
  258. accept=".jpg,.jpeg,.png,.GIF,.JPG,.PNG">
  259. <el-button type="primary" text>上传文件</el-button>
  260. </el-upload>
  261. </div>
  262. </div>
  263. </div>
  264. </template>
  265. </el-table-column>
  266. <el-table-column label="包材配件/单品" min-width="400">
  267. <template #default="{ row }">
  268. <div style="width: 100%">
  269. <div style="margin-bottom: 10px" v-if="!(route.query && route.query.detailId)">
  270. <el-button type="primary" @click="clickPackingFittings(index)">选择包材配件</el-button>
  271. </div>
  272. <el-table :data="row.orderSkuBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
  273. <el-table-column label="单价¥" width="120">
  274. <template #default="props">
  275. <div>
  276. <span>{{ moneyFormat(props.row.unitPrice, 2) }}</span>
  277. </div>
  278. </template>
  279. </el-table-column>
  280. <el-table-column label="数量" width="100">
  281. <template #default="props">
  282. <el-form-item
  283. :prop="'orderSkuList.' + index + '.orderSkuBomList.' + props.$index + '.quantity'"
  284. :rules="rules.quantity"
  285. :inline-message="true"
  286. style="width: 100%">
  287. <el-input-number
  288. onmousewheel="return false;"
  289. v-model="props.row.quantity"
  290. placeholder="数量"
  291. style="width: 100%"
  292. :controls="false"
  293. :min="0" />
  294. </el-form-item>
  295. </template>
  296. </el-table-column>
  297. <el-table-column label="名称" prop="bomSpecName" min-width="150" />
  298. <el-table-column label="总量" width="80">
  299. <template #default="props">
  300. {{ computeQuantity(index, props.$index) }}
  301. </template>
  302. </el-table-column>
  303. <el-table-column label="小计¥" width="100">
  304. <template #default="props">
  305. {{ moneyFormat(computeMoney(index, props.$index), 2) }}
  306. </template>
  307. </el-table-column>
  308. <el-table-column label="操作" align="center" fixed="right" width="60" v-if="!(route.query && route.query.detailId)">
  309. <template #default="props">
  310. <el-button type="danger" @click="clickDeletePackingFittings(index, props.$index)" text>删除</el-button>
  311. </template>
  312. </el-table-column>
  313. </el-table>
  314. </div>
  315. </template>
  316. </el-table-column>
  317. <el-table-column label="操作" align="center" fixed="right" width="60" v-if="!(route.query && route.query.detailId)">
  318. <template #default="{}">
  319. <el-button type="danger" @click="clickDelete(index)" text>删除</el-button>
  320. </template>
  321. </el-table-column>
  322. </el-table>
  323. <el-collapse-item :name="index">
  324. <template #title>
  325. <span>包装</span>
  326. </template>
  327. <div style="display: flex; padding: 8px 10px 0px">
  328. <div style="flex: 1; padding: 0px 10px">
  329. <div>包装要求:</div>
  330. <div v-if="route.query && route.query.detailId">
  331. <div v-html="getStyle(item.packageRemark)"></div>
  332. </div>
  333. <Editor
  334. v-else
  335. :value="item.packageRemark"
  336. @updateValue="
  337. (val) => {
  338. return updatePackageRemark(val, index);
  339. }
  340. "
  341. :ref="'editor_' + index" />
  342. </div>
  343. </div>
  344. </el-collapse-item>
  345. </div>
  346. </div>
  347. </el-collapse>
  348. </div>
  349. </template>
  350. <template #deliveryTime>
  351. <div style="width: 100%">
  352. <el-date-picker
  353. v-model="formData.data.deliveryTime"
  354. type="datetime"
  355. placeholder="请选择交货日期"
  356. value-format="YYYY-MM-DD HH:mm:ss"
  357. style="width: 100%" />
  358. </div>
  359. </template>
  360. <template #totalMonet>
  361. <div style="width: 100%; margin-left: 30px">
  362. <div>
  363. <span style="font-weight: 700; color: #6c88f1">产品总金额: ¥{{ moneyFormat(calculatedAmount("unitPrice"), 2) }}</span>
  364. <span style="font-weight: 700; color: #6c88f1; margin-left: 40px">
  365. 定制加工费: ¥{{ moneyFormat(calculatedAmount("customProcessingFee"), 2) }}
  366. </span>
  367. <span style="font-weight: 700; color: #6c88f1; margin-left: 40px">代发费: ¥{{ moneyFormat(calculatedAmount("lssueFee"), 2) }}</span>
  368. <span style="font-weight: 700; color: #6c88f1; margin-left: 40px">快递包材费: ¥{{ moneyFormat(computeDeliveryMaterialsFee(), 2) }} </span>
  369. <span style="font-weight: 700; color: #6c88f1; margin-left: 40px">包装人工费: ¥{{ moneyFormat(calculatedAmount("packingLabor"), 2) }}</span>
  370. <span style="font-weight: 700; color: #6c88f1; margin-left: 40px">包材费: ¥{{ moneyFormat(calculatedPackagingMaterialCost(), 2) }}</span>
  371. <span style="font-weight: 700; color: #6c88f1; margin-left: 40px">管理费: ¥{{ moneyFormat(calculatedAmount("managementFee"), 2) }}</span>
  372. </div>
  373. <div style="padding: 8px 0 0 0">
  374. <span style="font-weight: 700; color: red">订单总金额(含税): ¥{{ moneyFormat(calculatedTotalAmount(), 2) }}</span>
  375. </div>
  376. </div>
  377. </template>
  378. <template #attachments>
  379. <div style="width: 100%">
  380. <el-upload
  381. v-model:fileList="fileList"
  382. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  383. :data="uploadFileData"
  384. multiple
  385. :before-upload="beforeUpload"
  386. :on-success="onSuccessFile"
  387. :on-preview="onPreviewFile">
  388. <el-button style="background: #20b2aa; color: #fff; border: 1px solid #20b2aa">上传</el-button>
  389. </el-upload>
  390. </div>
  391. </template>
  392. <template #remark>
  393. <div style="width: 100%">
  394. <div style="margin: 0 2vw" v-if="formOption.disabled">
  395. <div v-html="getStyle(formData.data.remark)"></div>
  396. </div>
  397. <Editor v-else :value="formData.data.remark" @updateValue="updateValue" ref="editor" />
  398. </div>
  399. </template>
  400. </byForm>
  401. <el-dialog title="选择产品" v-if="openProduct" v-model="openProduct" width="90%">
  402. <SelectProduct :selectStatus="true" :type="'null'" @selectProduct="selectProduct"></SelectProduct>
  403. <template #footer>
  404. <el-button @click="openProduct = false" size="large">关 闭</el-button>
  405. </template>
  406. </el-dialog>
  407. <el-dialog title="选择包材配件" v-if="openPackingFittings" v-model="openPackingFittings" width="90%">
  408. <SelectBOM :selectStatus="true" :bomClassifyIdList="[2, 3]" @selectBOM="selectPackingFittings"></SelectBOM>
  409. <template #footer>
  410. <el-button @click="openPackingFittings = false" size="large">关 闭</el-button>
  411. </template>
  412. </el-dialog>
  413. <el-dialog title="选择图稿文件" v-if="openDrawingFile" v-model="openDrawingFile" width="70%">
  414. <SelectPicture @selectPic="selectPic"></SelectPicture>
  415. <template #footer>
  416. <el-button @click="openDrawingFile = false" size="large">关 闭</el-button>
  417. </template>
  418. </el-dialog>
  419. <el-dialog title="导入产品" v-if="openUpload" v-model="openUpload" width="60%">
  420. <el-upload class="upload-demo" :show-file-list="false" drag action="##" :http-request="giveawayServerLog" v-loading="loadingUpload">
  421. <el-icon class="el-icon--upload"><upload-filled /></el-icon>
  422. <div class="el-upload__text">拖拽文件进行上传</div>
  423. </el-upload>
  424. <template #footer>
  425. <el-button @click="openUpload = false">关 闭</el-button>
  426. </template>
  427. </el-dialog>
  428. </div>
  429. </template>
  430. <script setup>
  431. import byForm from "/src/components/byForm/index";
  432. import { ElMessage } from "element-plus";
  433. import Editor from "/src/components/Editor/index.vue";
  434. import { useRoute } from "vue-router";
  435. import SelectProduct from "/src/views/group/product/management/index";
  436. import SelectBOM from "/src/views/group/BOM/management/index";
  437. import SelectPicture from "/src/components/select-picture/index.vue";
  438. const { proxy } = getCurrentInstance();
  439. // 接收父组件的传值
  440. const props = defineProps({
  441. queryData: Object,
  442. });
  443. const route = useRoute();
  444. const submit = ref(null);
  445. const departmentList = ref([]);
  446. const activeNames = ref([]);
  447. const judgeStatus = () => {
  448. if (route.query.processType == 20 || route.query.processType == 10) {
  449. return true;
  450. }
  451. if (props.queryData.recordList && props.queryData.recordList.length > 0) {
  452. let data = props.queryData.recordList.filter((item) => item.status === 2 && item.nodeType !== 1);
  453. if (data && data.length > 0) {
  454. return true;
  455. }
  456. }
  457. return false;
  458. };
  459. const formOption = reactive({
  460. inline: true,
  461. labelWidth: "120px",
  462. itemWidth: 100,
  463. rules: [],
  464. labelPosition: "right",
  465. });
  466. const formData = reactive({
  467. data: {
  468. remark: "",
  469. type: 1,
  470. orderSkuList: [],
  471. fileList: [],
  472. },
  473. });
  474. const formConfig = computed(() => {
  475. return [
  476. {
  477. type: "title",
  478. title: "产品",
  479. label: "",
  480. },
  481. {
  482. type: "slot",
  483. prop: "orderSkuList",
  484. slotName: "orderSkuList",
  485. },
  486. {
  487. type: "title",
  488. title: "类型",
  489. label: "",
  490. },
  491. {
  492. type: "slot",
  493. prop: "type",
  494. slotName: "type",
  495. label: "订单类型",
  496. },
  497. {
  498. type: "slot",
  499. prop: "departmentId",
  500. slotName: "departmentId",
  501. label: "事业部",
  502. itemWidth: 25,
  503. },
  504. {
  505. type: "input",
  506. prop: "wlnCode",
  507. label: "E10单号",
  508. itemType: "text",
  509. itemWidth: 25,
  510. },
  511. formOption.disabled
  512. ? {}
  513. : {
  514. type: "title",
  515. title: "地址",
  516. label: "",
  517. },
  518. formOption.disabled
  519. ? {}
  520. : {
  521. type: "slot",
  522. slotName: "deliveryAddress",
  523. label: "收货地址",
  524. },
  525. formOption.disabled
  526. ? {}
  527. : {
  528. type: "slot",
  529. slotName: "consignee",
  530. label: "收货人",
  531. },
  532. {
  533. type: "title",
  534. title: "贸易",
  535. label: "",
  536. },
  537. {
  538. type: "slot",
  539. prop: "deliveryTime",
  540. slotName: "deliveryTime",
  541. label: "交货时间",
  542. itemWidth: 25,
  543. },
  544. {
  545. type: "select",
  546. label: "选择快递",
  547. prop: "expressDeliveryId",
  548. data: proxy.useUserStore().allDict["express_delivery"],
  549. itemWidth: 25,
  550. clearable: true,
  551. },
  552. {
  553. type: "select",
  554. label: "店铺来源",
  555. prop: "sourcePlatform",
  556. data: proxy.useUserStore().allDict["source_platform"],
  557. itemWidth: 25,
  558. clearable: true,
  559. },
  560. {
  561. type: "select",
  562. label: "店铺名称",
  563. prop: "shopName",
  564. data: proxy.useUserStore().allDict["shop_name"],
  565. itemWidth: 25,
  566. clearable: true,
  567. },
  568. {
  569. type: "title",
  570. title: "总计",
  571. label: "",
  572. },
  573. {
  574. type: "slot",
  575. prop: "totalMonet",
  576. slotName: "totalMonet",
  577. },
  578. {
  579. type: "title",
  580. title: "附件",
  581. label: "",
  582. },
  583. {
  584. type: "slot",
  585. slotName: "attachments",
  586. label: "附件",
  587. },
  588. {
  589. type: "title",
  590. title: "订单备注",
  591. label: "",
  592. },
  593. {
  594. type: "slot",
  595. slotName: "remark",
  596. },
  597. ];
  598. });
  599. const rules = ref({
  600. province: [{ required: true, message: "请输入省", trigger: "blur" }],
  601. detailedAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
  602. consignee: [{ required: true, message: "请输入联系人", trigger: "blur" }],
  603. consigneeNumber: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
  604. deliveryTime: [{ required: true, message: "请选择交货时间", trigger: "change" }],
  605. expressDeliveryId: [{ required: true, message: "请选择快递", trigger: "change" }],
  606. sourcePlatform: [{ required: true, message: "请选择店铺来源", trigger: "change" }],
  607. shopName: [{ required: true, message: "请选择店铺", trigger: "change" }],
  608. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  609. type: [{ required: true, message: "请选择订单类型", trigger: "change" }],
  610. departmentId: [{ required: true, message: "请选择事业部", trigger: "change" }],
  611. wlnCode: [{ required: true, message: "请输入E10单号", trigger: "blur" }],
  612. erpCode: [{ required: true, message: "请输入E10成品品号", trigger: "blur" }],
  613. });
  614. const getDemandData = () => {
  615. proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  616. if (res.rows && res.rows.length > 0) {
  617. departmentList.value = res.rows.map((item) => {
  618. return {
  619. dictKey: item.id,
  620. dictValue: item.name,
  621. };
  622. });
  623. }
  624. });
  625. };
  626. getDemandData();
  627. const drawingFileIndex = ref(0);
  628. const openDrawingFile = ref(false);
  629. const clickDrawingFile = (index) => {
  630. drawingFileIndex.value = index;
  631. openDrawingFile.value = true;
  632. };
  633. const selectPic = (row) => {
  634. formData.data.orderSkuList[drawingFileIndex.value].blueprint = row.imgUrl;
  635. formData.data.orderSkuList[drawingFileIndex.value].productionDocument = row.fileUrl;
  636. formData.data.orderSkuList[drawingFileIndex.value].artworkLibraryId = row.id;
  637. ElMessage({ message: "选择完成", type: "success" });
  638. openDrawingFile.value = false;
  639. };
  640. const openFile = (path) => {
  641. window.open(path);
  642. };
  643. const updatePackageRemark = (val, index) => {
  644. formData.data.orderSkuList[index].packageRemark = val;
  645. };
  646. const clickDelete = (index) => {
  647. formData.data.orderSkuList.splice(index, 1);
  648. getShippingPackage();
  649. };
  650. const updateValue = (val) => {
  651. formData.data.remark = val;
  652. };
  653. const getStyle = (text) => {
  654. if (text) {
  655. return text.replace(/\n|\r\n/g, "<br>");
  656. } else {
  657. return "";
  658. }
  659. };
  660. const openProduct = ref(false);
  661. const clickAddProduct = () => {
  662. openProduct.value = true;
  663. };
  664. const printType = ref([
  665. {
  666. dictKey: 1,
  667. dictValue: "单面",
  668. },
  669. {
  670. dictKey: 2,
  671. dictValue: "双面",
  672. },
  673. ]);
  674. const typeList = ref([
  675. {
  676. dictKey: 1,
  677. dictValue: "自主订单",
  678. },
  679. {
  680. dictKey: 2,
  681. dictValue: "委外订单",
  682. },
  683. ]);
  684. const skuDetail = ref({});
  685. const selectProduct = (row, SKU) => {
  686. if (row.id) {
  687. let list = formData.data.orderSkuList.filter((item) => item.skuSpecId === row.id && item.bomSpecId === row.bomSpecId);
  688. if (list && list.length > 0) {
  689. return ElMessage("该产品已添加");
  690. }
  691. if (skuDetail.value && skuDetail.value.id === SKU.id) {
  692. pushProduct(skuDetail.value, SKU, row);
  693. } else {
  694. proxy.post("/sku/detail", { id: SKU.id }).then((res) => {
  695. skuDetail.value = res;
  696. pushProduct(res, SKU, row);
  697. });
  698. }
  699. } else {
  700. ElMessage("添加失败");
  701. }
  702. };
  703. const pushProduct = async (res, SKU, row) => {
  704. let data = proxy.deepClone(res);
  705. let orderSkuBomList = [];
  706. if (data.skuSpecList && data.skuSpecList.length > 0) {
  707. let listTwo = data.skuSpecList.filter((item) => item.id === row.id);
  708. if (listTwo && listTwo.length > 0) {
  709. if (listTwo[0].packagingMaterialList && listTwo[0].packagingMaterialList.length > 0) {
  710. orderSkuBomList = listTwo[0].packagingMaterialList.map((item) => {
  711. return {
  712. bomSpecId: item.bomSpecId,
  713. unitPrice: item.internalSellingPrice,
  714. quantity: item.quantity,
  715. bomSpecName: item.name,
  716. };
  717. });
  718. }
  719. }
  720. }
  721. let inventoryQuantity = 0;
  722. let getSkuInventoryQuantity = await proxy.post("/skuSpec/getSkuInventoryQuantity", { id: row.id }).then((resQuantity) => {
  723. inventoryQuantity = resQuantity;
  724. });
  725. formData.data.orderSkuList.push({
  726. wlnSkuName: SKU.name,
  727. skuId: row.skuId,
  728. code: row.code,
  729. name: row.name,
  730. skuSpecId: row.id,
  731. bomSpecId: row.bomSpecId,
  732. quantity: undefined,
  733. erpCode: "",
  734. featureCode: "",
  735. customProcessingFee: "",
  736. customProcessingType: "",
  737. lssueFee: "",
  738. deliveryMaterialsFee: "",
  739. packingLabor: "",
  740. managementFee: "",
  741. unitPrice: "",
  742. printType: 1,
  743. packageRemark: "",
  744. orderSkuBomList: orderSkuBomList,
  745. blueprint: row.designImgUrl,
  746. productionDocument: row.sharedFolder,
  747. artworkLibraryId: "0",
  748. inventoryQuantity: inventoryQuantity,
  749. proofingFee: 0,
  750. });
  751. ElMessage({ message: "添加成功", type: "success" });
  752. };
  753. const rowIndex = ref(null);
  754. const openPackingFittings = ref(false);
  755. const clickPackingFittings = (index) => {
  756. rowIndex.value = index;
  757. openPackingFittings.value = true;
  758. };
  759. const clickDeletePackingFittings = (index, indexTwo) => {
  760. formData.data.orderSkuList[index].orderSkuBomList.splice(indexTwo, 1);
  761. };
  762. const selectPackingFittings = (data) => {
  763. if (formData.data.orderSkuList[rowIndex.value].orderSkuBomList && formData.data.orderSkuList[rowIndex.value].orderSkuBomList.length > 0) {
  764. let list = formData.data.orderSkuList[rowIndex.value].orderSkuBomList.filter((item) => item.bomSpecId === data.id);
  765. if (list && list.length > 0) {
  766. return ElMessage("包材配件已添加");
  767. }
  768. formData.data.orderSkuList[rowIndex.value].orderSkuBomList.push({
  769. bomSpecId: data.id,
  770. unitPrice: data.internalSellingPrice,
  771. quantity: undefined,
  772. bomSpecName: data.name,
  773. });
  774. } else {
  775. formData.data.orderSkuList[rowIndex.value].orderSkuBomList = [
  776. {
  777. bomSpecId: data.id,
  778. unitPrice: data.internalSellingPrice,
  779. quantity: undefined,
  780. bomSpecName: data.name,
  781. },
  782. ];
  783. }
  784. ElMessage({ message: "添加成功", type: "success" });
  785. };
  786. const changeQuantity = (index, status) => {
  787. if (formData.data.orderSkuList[index].quantity) {
  788. proxy
  789. .post("/orderInfo/getSkuSpecPrice", { skuSpecId: formData.data.orderSkuList[index].skuSpecId, quantity: formData.data.orderSkuList[index].quantity })
  790. .then((res) => {
  791. if (formData.data.orderSkuList[index].printType == 2 && res.customProcessingFee) {
  792. formData.data.orderSkuList[index].customProcessingFee = Number(Math.round(res.customProcessingFee * 2 * 100) / 100);
  793. } else {
  794. formData.data.orderSkuList[index].customProcessingFee = res.customProcessingFee;
  795. }
  796. formData.data.orderSkuList[index].customProcessingType = res.customProcessingType;
  797. formData.data.orderSkuList[index].lssueFee = res.lssueFee;
  798. formData.data.orderSkuList[index].packingLabor = res.packingLabor;
  799. formData.data.orderSkuList[index].managementFee = res.managementFee;
  800. formData.data.orderSkuList[index].unitPrice = res.unitPrice;
  801. });
  802. if (status) {
  803. getShippingPackage();
  804. }
  805. }
  806. };
  807. const getShippingPackage = () => {
  808. let skuSpecList = formData.data.orderSkuList.filter((item) => item.quantity && item.quantity > 0);
  809. if (skuSpecList && skuSpecList.length > 0) {
  810. skuSpecList = skuSpecList.map((item) => {
  811. return {
  812. skuSpecId: item.skuSpecId,
  813. quantity: item.quantity,
  814. };
  815. });
  816. proxy.post("/orderInfo/getSkuSpecPackageBomList", { skuSpecList: skuSpecList }).then((res) => {
  817. if (res && res.length > 0) {
  818. formData.data.orderPackageBomList = res.map((item) => {
  819. return {
  820. bomSpecId: item.bomSpecId,
  821. code: item.bomSpecCode,
  822. name: item.bomSpecName,
  823. internalSellingPrice: item.internalSellingPrice,
  824. quantity: item.quantity,
  825. };
  826. });
  827. } else {
  828. formData.data.orderPackageBomList = [];
  829. }
  830. });
  831. } else {
  832. formData.data.orderPackageBomList = [];
  833. }
  834. };
  835. const cellStyleName = ({ column, columnIndex }) => {
  836. if (column.label === "操作" && columnIndex === 3) {
  837. return "vertical-align";
  838. }
  839. };
  840. const uploadData = ref({});
  841. const uploadFile = async (file) => {
  842. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  843. uploadData.value = res.uploadBody;
  844. file.id = res.id;
  845. file.fileName = res.fileName;
  846. file.fileUrl = res.fileUrl;
  847. return true;
  848. };
  849. const handleSuccess = (UploadFile, index) => {
  850. formData.data.orderSkuList[index].productionDocument = UploadFile.raw.fileUrl;
  851. formData.data.orderSkuList[index].artworkLibraryId = "0";
  852. };
  853. const uploadImgData = ref({});
  854. const uploadImgFile = async (file) => {
  855. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  856. uploadImgData.value = res.uploadBody;
  857. file.id = res.id;
  858. file.fileName = res.fileName;
  859. file.fileUrl = res.fileUrl;
  860. return true;
  861. };
  862. const handleImgSuccess = (UploadFile, index) => {
  863. formData.data.orderSkuList[index].blueprint = UploadFile.raw.fileUrl;
  864. formData.data.orderSkuList[index].artworkLibraryId = "0";
  865. };
  866. const computeQuantity = (index, indexSKU) => {
  867. let quantity = 0;
  868. if (formData.data.orderSkuList[index].quantity && formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity) {
  869. quantity = Number(
  870. Math.round(formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity * formData.data.orderSkuList[index].quantity * 100) / 100
  871. );
  872. }
  873. return quantity;
  874. };
  875. const computeMoney = (index, indexSKU) => {
  876. let money = 0;
  877. if (
  878. formData.data.orderSkuList[index].quantity &&
  879. formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity &&
  880. formData.data.orderSkuList[index].orderSkuBomList[indexSKU].unitPrice
  881. ) {
  882. money = Number(
  883. Math.round(
  884. formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity *
  885. formData.data.orderSkuList[index].orderSkuBomList[indexSKU].unitPrice *
  886. formData.data.orderSkuList[index].quantity *
  887. 100
  888. ) / 100
  889. );
  890. }
  891. return money;
  892. };
  893. const getSubtotal = (item) => {
  894. let money = 0;
  895. if (item.quantity) {
  896. money = Number(
  897. Math.round(
  898. (item.customProcessingFee + item.deliveryMaterialsFee + item.lssueFee + item.packingLabor + item.managementFee + item.unitPrice) * item.quantity * 100
  899. ) / 100
  900. );
  901. }
  902. return money;
  903. };
  904. const calculatedAmount = (label) => {
  905. let money = 0;
  906. if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
  907. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  908. if (formData.data.orderSkuList[i].quantity && formData.data.orderSkuList[i][label]) {
  909. money = Number(Math.round((money + formData.data.orderSkuList[i][label] * formData.data.orderSkuList[i].quantity) * 100) / 100);
  910. }
  911. }
  912. }
  913. return money;
  914. };
  915. const calculatedPackagingMaterialCost = () => {
  916. let money = 0;
  917. if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
  918. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  919. if (formData.data.orderSkuList[i].orderSkuBomList && formData.data.orderSkuList[i].orderSkuBomList.length > 0) {
  920. for (let j = 0; j < formData.data.orderSkuList[i].orderSkuBomList.length; j++) {
  921. if (formData.data.orderSkuList[i].orderSkuBomList[j].quantity && formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) {
  922. money = Number(
  923. Math.round(
  924. (money +
  925. formData.data.orderSkuList[i].orderSkuBomList[j].quantity *
  926. formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice *
  927. formData.data.orderSkuList[i].quantity) *
  928. 100
  929. ) / 100
  930. );
  931. }
  932. }
  933. }
  934. }
  935. }
  936. return money;
  937. };
  938. const calculatedTotalAmount = () => {
  939. let money = 0;
  940. money = Number(
  941. Math.round(
  942. (calculatedAmount("unitPrice") +
  943. calculatedAmount("customProcessingFee") +
  944. calculatedAmount("lssueFee") +
  945. computeDeliveryMaterialsFee() +
  946. calculatedAmount("packingLabor") +
  947. calculatedAmount("managementFee") +
  948. calculatedPackagingMaterialCost()) *
  949. 100
  950. ) / 100
  951. );
  952. return money;
  953. };
  954. const fileList = ref([]);
  955. const uploadFileData = ref({});
  956. const beforeUpload = async (file) => {
  957. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  958. uploadFileData.value = res.uploadBody;
  959. file.id = res.id;
  960. file.fileName = res.fileName;
  961. file.fileUrl = res.fileUrl;
  962. file.uploadState = true;
  963. return true;
  964. };
  965. const onSuccessFile = (any, UploadFile) => {
  966. UploadFile.raw.uploadState = false;
  967. };
  968. const onPreviewFile = (file) => {
  969. window.open(file.raw.fileUrl, "_blank");
  970. };
  971. const uploadAdhesiveData = ref({});
  972. const uploadAdhesiveFile = async (file) => {
  973. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  974. uploadAdhesiveData.value = res.uploadBody;
  975. file.id = res.id;
  976. file.fileName = res.fileName;
  977. file.fileUrl = res.fileUrl;
  978. return true;
  979. };
  980. const handleAdhesiveSuccess = (UploadFile, index) => {
  981. formData.data.orderSkuList[index].selfAdhesiveStickerFile = {
  982. id: UploadFile.raw.id,
  983. fileName: UploadFile.raw.fileName,
  984. fileUrl: UploadFile.raw.fileUrl,
  985. };
  986. };
  987. const getFormData = () => {
  988. return proxy.deepClone(formData.data);
  989. };
  990. const handleSubmit = async (flag) => {
  991. if (flag) {
  992. return true;
  993. } else {
  994. let status = await proxy.$refs.submit.handleSubmit(() => {});
  995. if (status) {
  996. if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
  997. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  998. if (!formData.data.orderSkuList[i].blueprint) {
  999. ElMessage("请选择设计图");
  1000. return false;
  1001. }
  1002. if (!formData.data.orderSkuList[i].productionDocument) {
  1003. ElMessage("请选择生产文件");
  1004. return false;
  1005. }
  1006. let packagingMaterialCost = 0;
  1007. if (formData.data.orderSkuList[i].quantity) {
  1008. if (formData.data.orderSkuList[i].orderSkuBomList && formData.data.orderSkuList[i].orderSkuBomList.length > 0) {
  1009. for (let j = 0; j < formData.data.orderSkuList[i].orderSkuBomList.length; j++) {
  1010. if (formData.data.orderSkuList[i].orderSkuBomList[j].quantity && formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) {
  1011. packagingMaterialCost = Number(
  1012. Math.round(
  1013. (packagingMaterialCost +
  1014. formData.data.orderSkuList[i].orderSkuBomList[j].quantity * formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) *
  1015. 100
  1016. ) / 100
  1017. );
  1018. }
  1019. }
  1020. }
  1021. }
  1022. formData.data.orderSkuList[i].packagingMaterialCost = packagingMaterialCost;
  1023. }
  1024. formData.data.productTotalAmount = calculatedAmount("unitPrice");
  1025. formData.data.customProcessingFee = calculatedAmount("customProcessingFee");
  1026. formData.data.lssueFee = calculatedAmount("lssueFee");
  1027. formData.data.deliveryMaterialsFee = computeDeliveryMaterialsFee();
  1028. formData.data.packingLabor = calculatedAmount("packingLabor");
  1029. formData.data.managementFee = calculatedAmount("managementFee");
  1030. formData.data.packagingMaterialCost = calculatedPackagingMaterialCost();
  1031. formData.data.totalAmount = calculatedTotalAmount();
  1032. formData.data.proofingFee = 0;
  1033. if (fileList.value && fileList.value.length > 0) {
  1034. for (let i = 0; i < fileList.value.length; i++) {
  1035. if (fileList.value[i].raw.uploadState) {
  1036. ElMessage("文件上传中,请稍后提交");
  1037. return false;
  1038. }
  1039. }
  1040. formData.data.fileList = fileList.value.map((item) => {
  1041. return {
  1042. id: item.raw.id,
  1043. fileName: item.raw.fileName,
  1044. fileUrl: item.raw.fileUrl,
  1045. };
  1046. });
  1047. } else {
  1048. formData.data.fileList = [];
  1049. }
  1050. } else {
  1051. return ElMessage("请添加产品");
  1052. }
  1053. return true;
  1054. } else {
  1055. setTimeout(() => {
  1056. const errorDiv = document.getElementsByClassName("is-error");
  1057. errorDiv[0].scrollIntoView();
  1058. }, 0);
  1059. }
  1060. return false;
  1061. }
  1062. };
  1063. watch(
  1064. () => props.queryData,
  1065. (newValue) => {
  1066. formOption.disabled = judgeStatus();
  1067. if (props.queryData && ["10", "20", "30", "40"].includes(route.query.processType)) {
  1068. formData.data = proxy.deepClone(newValue);
  1069. if (route.query.id) {
  1070. proxy.$refs.editor.changeHtml(formData.data.remark);
  1071. }
  1072. let list = [formData.data.id];
  1073. if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
  1074. list = list.concat(formData.data.orderSkuList.map((item) => item.id));
  1075. proxy.post("/fileInfo/getList", { businessIdList: list }).then((fileObj) => {
  1076. if (fileObj[formData.data.id] && fileObj[formData.data.id].length > 0) {
  1077. let file = fileObj[formData.data.id].filter((item) => item.businessType == "0");
  1078. if (file && file.length > 0) {
  1079. fileList.value = file.map((item) => {
  1080. return {
  1081. raw: item,
  1082. name: item.fileName,
  1083. url: item.fileUrl,
  1084. };
  1085. });
  1086. } else {
  1087. fileList.value = [];
  1088. }
  1089. let outerBoxSelfAdhesiveStickerFile = fileObj[formData.data.id].filter((item) => item.businessType == "1");
  1090. if (outerBoxSelfAdhesiveStickerFile && outerBoxSelfAdhesiveStickerFile.length > 0) {
  1091. formData.data.outerBoxSelfAdhesiveStickerFile = outerBoxSelfAdhesiveStickerFile[0];
  1092. } else {
  1093. formData.data.outerBoxSelfAdhesiveStickerFile = {};
  1094. }
  1095. }
  1096. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  1097. if (fileObj[formData.data.orderSkuList[i].id] && fileObj[formData.data.orderSkuList[i].id].length > 0) {
  1098. formData.data.orderSkuList[i].selfAdhesiveStickerFile = {
  1099. id: fileObj[formData.data.orderSkuList[i].id][0].id,
  1100. fileName: fileObj[formData.data.orderSkuList[i].id][0].fileName,
  1101. fileUrl: fileObj[formData.data.orderSkuList[i].id][0].fileUrl,
  1102. };
  1103. }
  1104. }
  1105. });
  1106. }
  1107. }
  1108. },
  1109. {
  1110. deep: true,
  1111. }
  1112. );
  1113. const saveShippingPackage = (data) => {
  1114. formData.data.orderPackageBomList = data.orderPackageBomList;
  1115. formData.data.outerBoxSelfAdhesiveStickerFile = data.outerBoxSelfAdhesiveStickerFile;
  1116. };
  1117. const computeDeliveryMaterialsFee = () => {
  1118. let money = 0;
  1119. if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
  1120. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  1121. if (formData.data.orderSkuList[i].deliveryMaterialsFee && formData.data.orderSkuList[i].quantity) {
  1122. money = Number(Math.round((money + formData.data.orderSkuList[i].deliveryMaterialsFee * formData.data.orderSkuList[i].quantity) * 100) / 100);
  1123. }
  1124. }
  1125. }
  1126. return money;
  1127. };
  1128. const computeMaterialsFeeAll = () => {
  1129. let money = 0;
  1130. if (formData.data.orderPackageBomList && formData.data.orderPackageBomList.length > 0) {
  1131. for (let i = 0; i < formData.data.orderPackageBomList.length; i++) {
  1132. if (formData.data.orderPackageBomList[i].internalSellingPrice && formData.data.orderPackageBomList[i].quantity) {
  1133. money = Number(
  1134. Math.round((money + formData.data.orderPackageBomList[i].internalSellingPrice * formData.data.orderPackageBomList[i].quantity) * 100) / 100
  1135. );
  1136. }
  1137. }
  1138. }
  1139. return money;
  1140. };
  1141. const computeSingleDeliveryMaterialsFee = (index) => {
  1142. let money = computeMaterialsFeeAll();
  1143. let list = formData.data.orderSkuList.filter((item) => item.quantity > 0);
  1144. let num = 0;
  1145. let singlePrice = 0;
  1146. if (list && list.length > 0) {
  1147. for (let i = 0; i < list.length; i++) {
  1148. num = Number(Math.round(num + list[i].quantity));
  1149. }
  1150. singlePrice = Number(Math.ceil((money / num) * 1000) / 1000);
  1151. }
  1152. formData.data.orderSkuList[index].deliveryMaterialsFee = singlePrice;
  1153. return formData.data.orderSkuList[index].deliveryMaterialsFee;
  1154. };
  1155. const openUpload = ref(false);
  1156. const loadingUpload = ref(false);
  1157. const clickUploadProduct = () => {
  1158. loadingUpload.value = false;
  1159. openUpload.value = true;
  1160. };
  1161. const giveawayServerLog = (params) => {
  1162. let file = params.file;
  1163. let formFile = new FormData();
  1164. formFile.append("file", file);
  1165. loadingUpload.value = true;
  1166. proxy.postUploadFile("/skuSpec/getSkuSpecListFromImport", formFile).then(
  1167. (res) => {
  1168. ElMessage({ message: "导入成功", type: "success" });
  1169. openUpload.value = false;
  1170. if (res.data && res.data.length > 0) {
  1171. for (let i = 0; i < res.data.length; i++) {
  1172. let list = formData.data.orderSkuList.filter((item) => item.skuSpecId === res.data[i].id && item.bomSpecId === res.data[i].bomSpecId);
  1173. if (!(list && list.length > 0)) {
  1174. let orderSkuBomList = [];
  1175. if (res.data[i].packagingMaterialList && res.data[i].packagingMaterialList.length > 0) {
  1176. orderSkuBomList = res.data[i].packagingMaterialList.map((item) => {
  1177. return {
  1178. bomSpecId: item.bomSpecId,
  1179. unitPrice: item.internalSellingPrice,
  1180. quantity: item.quantity,
  1181. bomSpecName: item.name,
  1182. };
  1183. });
  1184. }
  1185. formData.data.orderSkuList.push({
  1186. wlnSkuName: res.data[i].wlnSkuName,
  1187. skuId: res.data[i].skuId,
  1188. code: res.data[i].code,
  1189. name: res.data[i].name,
  1190. skuSpecId: res.data[i].id,
  1191. bomSpecId: res.data[i].bomSpecId,
  1192. quantity: undefined,
  1193. erpCode: "",
  1194. featureCode: "",
  1195. customProcessingFee: "",
  1196. customProcessingType: "",
  1197. lssueFee: "",
  1198. deliveryMaterialsFee: "",
  1199. packingLabor: "",
  1200. managementFee: "",
  1201. unitPrice: "",
  1202. printType: 1,
  1203. packageRemark: "",
  1204. orderSkuBomList: orderSkuBomList,
  1205. blueprint: res.data[i].designImgUrl,
  1206. productionDocument: res.data[i].sharedFolder,
  1207. artworkLibraryId: "0",
  1208. inventoryQuantity: res.data[i].inventoryQuantity,
  1209. proofingFee: 0,
  1210. });
  1211. }
  1212. }
  1213. }
  1214. },
  1215. (err) => {
  1216. console.log(err);
  1217. loadingUpload.value = false;
  1218. }
  1219. );
  1220. };
  1221. // 向父组件暴露
  1222. defineExpose({ getFormData, handleSubmit, saveShippingPackage });
  1223. </script>
  1224. <style lang="scss" scoped>
  1225. ::v-deep(.el-input-number .el-input__inner) {
  1226. text-align: left;
  1227. }
  1228. :deep(.el-dialog) {
  1229. margin-top: 10px !important;
  1230. margin-bottom: 10px !important;
  1231. }
  1232. :deep(.ql-editor) {
  1233. height: auto;
  1234. }
  1235. :deep(.el-collapse-item__header) {
  1236. justify-content: center;
  1237. }
  1238. :deep(.el-collapse-item__arrow) {
  1239. margin: 0;
  1240. }
  1241. :deep(.el-table__cell) {
  1242. vertical-align: top;
  1243. }
  1244. :deep(.vertical-align) {
  1245. vertical-align: middle;
  1246. }
  1247. .shippingPackage {
  1248. .el-form-item {
  1249. margin-bottom: 0;
  1250. }
  1251. }
  1252. </style>