order.vue 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221
  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. };
  649. const updateValue = (val) => {
  650. formData.data.remark = val;
  651. };
  652. const getStyle = (text) => {
  653. if (text) {
  654. return text.replace(/\n|\r\n/g, "<br>");
  655. } else {
  656. return "";
  657. }
  658. };
  659. const openProduct = ref(false);
  660. const clickAddProduct = () => {
  661. openProduct.value = true;
  662. };
  663. const printType = ref([
  664. {
  665. dictKey: 1,
  666. dictValue: "单面",
  667. },
  668. {
  669. dictKey: 2,
  670. dictValue: "双面",
  671. },
  672. ]);
  673. const typeList = ref([
  674. {
  675. dictKey: 1,
  676. dictValue: "自主订单",
  677. },
  678. {
  679. dictKey: 2,
  680. dictValue: "委外订单",
  681. },
  682. ]);
  683. const skuDetail = ref({});
  684. const selectProduct = (row, SKU) => {
  685. if (row.id) {
  686. let list = formData.data.orderSkuList.filter((item) => item.skuSpecId === row.id && item.bomSpecId === row.bomSpecId);
  687. if (list && list.length > 0) {
  688. return ElMessage("该产品已添加");
  689. }
  690. if (skuDetail.value && skuDetail.value.id === SKU.id) {
  691. pushProduct(skuDetail.value, SKU, row);
  692. } else {
  693. proxy.post("/sku/detail", { id: SKU.id }).then((res) => {
  694. skuDetail.value = res;
  695. pushProduct(res, SKU, row);
  696. });
  697. }
  698. } else {
  699. ElMessage("添加失败");
  700. }
  701. };
  702. const pushProduct = async (res, SKU, row) => {
  703. let data = proxy.deepClone(res);
  704. let orderSkuBomList = [];
  705. if (data.skuSpecList && data.skuSpecList.length > 0) {
  706. let listTwo = data.skuSpecList.filter((item) => item.id === row.id);
  707. if (listTwo && listTwo.length > 0) {
  708. if (listTwo[0].packagingMaterialList && listTwo[0].packagingMaterialList.length > 0) {
  709. orderSkuBomList = listTwo[0].packagingMaterialList.map((item) => {
  710. return {
  711. bomSpecId: item.bomSpecId,
  712. unitPrice: item.internalSellingPrice,
  713. quantity: item.quantity,
  714. bomSpecName: item.name,
  715. };
  716. });
  717. }
  718. }
  719. }
  720. let inventoryQuantity = 0;
  721. let getSkuInventoryQuantity = await proxy.post("/skuSpec/getSkuInventoryQuantity", { id: row.id }).then((resQuantity) => {
  722. inventoryQuantity = resQuantity;
  723. });
  724. formData.data.orderSkuList.push({
  725. wlnSkuName: SKU.name,
  726. skuId: row.skuId,
  727. code: row.code,
  728. name: row.name,
  729. skuSpecId: row.id,
  730. bomSpecId: row.bomSpecId,
  731. quantity: undefined,
  732. erpCode: "",
  733. featureCode: "",
  734. customProcessingFee: "",
  735. customProcessingType: "",
  736. lssueFee: "",
  737. deliveryMaterialsFee: "",
  738. packingLabor: "",
  739. managementFee: "",
  740. unitPrice: "",
  741. printType: 1,
  742. packageRemark: "",
  743. orderSkuBomList: orderSkuBomList,
  744. blueprint: row.designImgUrl,
  745. productionDocument: row.sharedFolder,
  746. artworkLibraryId: "0",
  747. inventoryQuantity: inventoryQuantity,
  748. proofingFee: 0,
  749. });
  750. ElMessage({ message: "添加成功", type: "success" });
  751. };
  752. const rowIndex = ref(null);
  753. const openPackingFittings = ref(false);
  754. const clickPackingFittings = (index) => {
  755. rowIndex.value = index;
  756. openPackingFittings.value = true;
  757. };
  758. const clickDeletePackingFittings = (index, indexTwo) => {
  759. formData.data.orderSkuList[index].orderSkuBomList.splice(indexTwo, 1);
  760. };
  761. const selectPackingFittings = (data) => {
  762. if (formData.data.orderSkuList[rowIndex.value].orderSkuBomList && formData.data.orderSkuList[rowIndex.value].orderSkuBomList.length > 0) {
  763. let list = formData.data.orderSkuList[rowIndex.value].orderSkuBomList.filter((item) => item.bomSpecId === data.id);
  764. if (list && list.length > 0) {
  765. return ElMessage("包材配件已添加");
  766. }
  767. formData.data.orderSkuList[rowIndex.value].orderSkuBomList.push({
  768. bomSpecId: data.id,
  769. unitPrice: data.internalSellingPrice,
  770. quantity: undefined,
  771. bomSpecName: data.name,
  772. });
  773. } else {
  774. formData.data.orderSkuList[rowIndex.value].orderSkuBomList = [
  775. {
  776. bomSpecId: data.id,
  777. unitPrice: data.internalSellingPrice,
  778. quantity: undefined,
  779. bomSpecName: data.name,
  780. },
  781. ];
  782. }
  783. ElMessage({ message: "添加成功", type: "success" });
  784. };
  785. const changeQuantity = (index) => {
  786. if (formData.data.orderSkuList[index].quantity) {
  787. proxy
  788. .post("/orderInfo/getSkuSpecPrice", {
  789. skuSpecId: formData.data.orderSkuList[index].skuSpecId,
  790. quantity: formData.data.orderSkuList[index].quantity,
  791. random: proxy.random(),
  792. })
  793. .then((res) => {
  794. if (formData.data.orderSkuList[index].printType == 2 && res.customProcessingFee) {
  795. formData.data.orderSkuList[index].customProcessingFee = Number(Math.round(res.customProcessingFee * 2 * 100) / 100);
  796. } else {
  797. formData.data.orderSkuList[index].customProcessingFee = res.customProcessingFee;
  798. }
  799. formData.data.orderSkuList[index].customProcessingType = res.customProcessingType;
  800. formData.data.orderSkuList[index].deliveryMaterialsFee = res.deliveryMaterialsFee;
  801. formData.data.orderSkuList[index].lssueFee = res.lssueFee;
  802. formData.data.orderSkuList[index].packingLabor = res.packingLabor;
  803. formData.data.orderSkuList[index].managementFee = res.managementFee;
  804. formData.data.orderSkuList[index].unitPrice = res.unitPrice;
  805. });
  806. }
  807. };
  808. const cellStyleName = ({ column, columnIndex }) => {
  809. if (column.label === "操作" && columnIndex === 3) {
  810. return "vertical-align";
  811. }
  812. };
  813. const uploadData = ref({});
  814. const uploadFile = async (file) => {
  815. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  816. uploadData.value = res.uploadBody;
  817. file.id = res.id;
  818. file.fileName = res.fileName;
  819. file.fileUrl = res.fileUrl;
  820. return true;
  821. };
  822. const handleSuccess = (UploadFile, index) => {
  823. formData.data.orderSkuList[index].productionDocument = UploadFile.raw.fileUrl;
  824. formData.data.orderSkuList[index].artworkLibraryId = "0";
  825. };
  826. const uploadImgData = ref({});
  827. const uploadImgFile = async (file) => {
  828. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  829. uploadImgData.value = res.uploadBody;
  830. file.id = res.id;
  831. file.fileName = res.fileName;
  832. file.fileUrl = res.fileUrl;
  833. return true;
  834. };
  835. const handleImgSuccess = (UploadFile, index) => {
  836. formData.data.orderSkuList[index].blueprint = UploadFile.raw.fileUrl;
  837. formData.data.orderSkuList[index].artworkLibraryId = "0";
  838. };
  839. const computeQuantity = (index, indexSKU) => {
  840. let quantity = 0;
  841. if (formData.data.orderSkuList[index].quantity && formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity) {
  842. quantity = Number(
  843. Math.round(formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity * formData.data.orderSkuList[index].quantity * 100) / 100
  844. );
  845. }
  846. return quantity;
  847. };
  848. const computeMoney = (index, indexSKU) => {
  849. let money = 0;
  850. if (
  851. formData.data.orderSkuList[index].quantity &&
  852. formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity &&
  853. formData.data.orderSkuList[index].orderSkuBomList[indexSKU].unitPrice
  854. ) {
  855. money = Number(
  856. Math.round(
  857. formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity *
  858. formData.data.orderSkuList[index].orderSkuBomList[indexSKU].unitPrice *
  859. formData.data.orderSkuList[index].quantity *
  860. 100
  861. ) / 100
  862. );
  863. }
  864. return money;
  865. };
  866. const getSubtotal = (item) => {
  867. let money = 0;
  868. if (item.quantity) {
  869. money = Number(
  870. Math.round(
  871. (item.customProcessingFee + item.deliveryMaterialsFee + item.lssueFee + item.packingLabor + item.managementFee + item.unitPrice) * item.quantity * 100
  872. ) / 100
  873. );
  874. }
  875. return money;
  876. };
  877. const calculatedAmount = (label) => {
  878. let money = 0;
  879. if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
  880. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  881. if (formData.data.orderSkuList[i].quantity && formData.data.orderSkuList[i][label]) {
  882. money = Number(Math.round((money + formData.data.orderSkuList[i][label] * formData.data.orderSkuList[i].quantity) * 100) / 100);
  883. }
  884. }
  885. }
  886. return money;
  887. };
  888. const calculatedPackagingMaterialCost = () => {
  889. let money = 0;
  890. if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
  891. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  892. if (formData.data.orderSkuList[i].orderSkuBomList && formData.data.orderSkuList[i].orderSkuBomList.length > 0) {
  893. for (let j = 0; j < formData.data.orderSkuList[i].orderSkuBomList.length; j++) {
  894. if (formData.data.orderSkuList[i].orderSkuBomList[j].quantity && formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) {
  895. money = Number(
  896. Math.round(
  897. (money +
  898. formData.data.orderSkuList[i].orderSkuBomList[j].quantity *
  899. formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice *
  900. formData.data.orderSkuList[i].quantity) *
  901. 100
  902. ) / 100
  903. );
  904. }
  905. }
  906. }
  907. }
  908. }
  909. return money;
  910. };
  911. const calculatedTotalAmount = () => {
  912. let money = 0;
  913. money = Number(
  914. Math.round(
  915. (calculatedAmount("unitPrice") +
  916. calculatedAmount("customProcessingFee") +
  917. calculatedAmount("lssueFee") +
  918. computeDeliveryMaterialsFee() +
  919. calculatedAmount("packingLabor") +
  920. calculatedAmount("managementFee") +
  921. calculatedPackagingMaterialCost()) *
  922. 100
  923. ) / 100
  924. );
  925. return money;
  926. };
  927. const fileList = ref([]);
  928. const uploadFileData = ref({});
  929. const beforeUpload = async (file) => {
  930. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  931. uploadFileData.value = res.uploadBody;
  932. file.id = res.id;
  933. file.fileName = res.fileName;
  934. file.fileUrl = res.fileUrl;
  935. file.uploadState = true;
  936. return true;
  937. };
  938. const onSuccessFile = (any, UploadFile) => {
  939. UploadFile.raw.uploadState = false;
  940. };
  941. const onPreviewFile = (file) => {
  942. window.open(file.raw.fileUrl, "_blank");
  943. };
  944. const uploadAdhesiveData = ref({});
  945. const uploadAdhesiveFile = async (file) => {
  946. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  947. uploadAdhesiveData.value = res.uploadBody;
  948. file.id = res.id;
  949. file.fileName = res.fileName;
  950. file.fileUrl = res.fileUrl;
  951. return true;
  952. };
  953. const handleAdhesiveSuccess = (UploadFile, index) => {
  954. formData.data.orderSkuList[index].selfAdhesiveStickerFile = {
  955. id: UploadFile.raw.id,
  956. fileName: UploadFile.raw.fileName,
  957. fileUrl: UploadFile.raw.fileUrl,
  958. };
  959. };
  960. const getFormData = () => {
  961. return proxy.deepClone(formData.data);
  962. };
  963. const handleSubmit = async (flag) => {
  964. if (flag) {
  965. return true;
  966. } else {
  967. let status = await proxy.$refs.submit.handleSubmit(() => {});
  968. if (status) {
  969. if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
  970. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  971. if (!formData.data.orderSkuList[i].blueprint) {
  972. ElMessage("请选择设计图");
  973. return false;
  974. }
  975. if (!formData.data.orderSkuList[i].productionDocument) {
  976. ElMessage("请选择生产文件");
  977. return false;
  978. }
  979. let packagingMaterialCost = 0;
  980. if (formData.data.orderSkuList[i].quantity) {
  981. if (formData.data.orderSkuList[i].orderSkuBomList && formData.data.orderSkuList[i].orderSkuBomList.length > 0) {
  982. for (let j = 0; j < formData.data.orderSkuList[i].orderSkuBomList.length; j++) {
  983. if (formData.data.orderSkuList[i].orderSkuBomList[j].quantity && formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) {
  984. packagingMaterialCost = Number(
  985. Math.round(
  986. (packagingMaterialCost +
  987. formData.data.orderSkuList[i].orderSkuBomList[j].quantity * formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) *
  988. 100
  989. ) / 100
  990. );
  991. }
  992. }
  993. }
  994. }
  995. formData.data.orderSkuList[i].packagingMaterialCost = packagingMaterialCost;
  996. }
  997. formData.data.productTotalAmount = calculatedAmount("unitPrice");
  998. formData.data.customProcessingFee = calculatedAmount("customProcessingFee");
  999. formData.data.lssueFee = calculatedAmount("lssueFee");
  1000. formData.data.deliveryMaterialsFee = computeDeliveryMaterialsFee();
  1001. formData.data.packingLabor = calculatedAmount("packingLabor");
  1002. formData.data.managementFee = calculatedAmount("managementFee");
  1003. formData.data.packagingMaterialCost = calculatedPackagingMaterialCost();
  1004. formData.data.totalAmount = calculatedTotalAmount();
  1005. formData.data.proofingFee = 0;
  1006. if (fileList.value && fileList.value.length > 0) {
  1007. for (let i = 0; i < fileList.value.length; i++) {
  1008. if (fileList.value[i].raw.uploadState) {
  1009. ElMessage("文件上传中,请稍后提交");
  1010. return false;
  1011. }
  1012. }
  1013. formData.data.fileList = fileList.value.map((item) => {
  1014. return {
  1015. id: item.raw.id,
  1016. fileName: item.raw.fileName,
  1017. fileUrl: item.raw.fileUrl,
  1018. };
  1019. });
  1020. } else {
  1021. formData.data.fileList = [];
  1022. }
  1023. } else {
  1024. return ElMessage("请添加产品");
  1025. }
  1026. return true;
  1027. } else {
  1028. setTimeout(() => {
  1029. const errorDiv = document.getElementsByClassName("is-error");
  1030. errorDiv[0].scrollIntoView();
  1031. }, 0);
  1032. }
  1033. return false;
  1034. }
  1035. };
  1036. watch(
  1037. () => props.queryData,
  1038. (newValue) => {
  1039. formOption.disabled = judgeStatus();
  1040. if (props.queryData && ["10", "20", "30", "40"].includes(route.query.processType)) {
  1041. formData.data = proxy.deepClone(newValue);
  1042. if (route.query.id) {
  1043. proxy.$refs.editor.changeHtml(formData.data.remark);
  1044. }
  1045. let list = [formData.data.id];
  1046. if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
  1047. list = list.concat(formData.data.orderSkuList.map((item) => item.id));
  1048. proxy.post("/fileInfo/getList", { businessIdList: list }).then((fileObj) => {
  1049. if (fileObj[formData.data.id] && fileObj[formData.data.id].length > 0) {
  1050. let file = fileObj[formData.data.id].filter((item) => item.businessType == "0");
  1051. if (file && file.length > 0) {
  1052. fileList.value = file.map((item) => {
  1053. return {
  1054. raw: item,
  1055. name: item.fileName,
  1056. url: item.fileUrl,
  1057. };
  1058. });
  1059. } else {
  1060. fileList.value = [];
  1061. }
  1062. let outerBoxSelfAdhesiveStickerFile = fileObj[formData.data.id].filter((item) => item.businessType == "1");
  1063. if (outerBoxSelfAdhesiveStickerFile && outerBoxSelfAdhesiveStickerFile.length > 0) {
  1064. formData.data.outerBoxSelfAdhesiveStickerFile = outerBoxSelfAdhesiveStickerFile[0];
  1065. } else {
  1066. formData.data.outerBoxSelfAdhesiveStickerFile = {};
  1067. }
  1068. }
  1069. for (let i = 0; i < formData.data.orderSkuList.length; i++) {
  1070. if (fileObj[formData.data.orderSkuList[i].id] && fileObj[formData.data.orderSkuList[i].id].length > 0) {
  1071. formData.data.orderSkuList[i].selfAdhesiveStickerFile = {
  1072. id: fileObj[formData.data.orderSkuList[i].id][0].id,
  1073. fileName: fileObj[formData.data.orderSkuList[i].id][0].fileName,
  1074. fileUrl: fileObj[formData.data.orderSkuList[i].id][0].fileUrl,
  1075. };
  1076. }
  1077. }
  1078. });
  1079. }
  1080. }
  1081. },
  1082. {
  1083. deep: true,
  1084. }
  1085. );
  1086. const saveShippingPackage = (data) => {
  1087. formData.data.orderPackageBomList = data.orderPackageBomList;
  1088. formData.data.outerBoxSelfAdhesiveStickerFile = data.outerBoxSelfAdhesiveStickerFile;
  1089. };
  1090. const computeDeliveryMaterialsFee = () => {
  1091. let money = 0;
  1092. if (formData.data.orderPackageBomList && formData.data.orderPackageBomList.length > 0) {
  1093. for (let i = 0; i < formData.data.orderPackageBomList.length; i++) {
  1094. if (formData.data.orderPackageBomList[i].internalSellingPrice && formData.data.orderPackageBomList[i].quantity) {
  1095. money = Number(
  1096. Math.round((money + formData.data.orderPackageBomList[i].internalSellingPrice * formData.data.orderPackageBomList[i].quantity) * 100) / 100
  1097. );
  1098. }
  1099. }
  1100. }
  1101. return money;
  1102. };
  1103. const computeSingleDeliveryMaterialsFee = (index) => {
  1104. let money = computeDeliveryMaterialsFee();
  1105. let list = formData.data.orderSkuList.filter((item) => item.quantity > 0);
  1106. let num = 0;
  1107. let singlePrice = 0;
  1108. if (list && list.length > 0) {
  1109. for (let i = 0; i < list.length; i++) {
  1110. num = Number(Math.round(num + list[i].quantity));
  1111. }
  1112. singlePrice = Number(Math.ceil((money / num) * 1000) / 1000);
  1113. }
  1114. formData.data.orderSkuList[index].deliveryMaterialsFee = singlePrice;
  1115. return formData.data.orderSkuList[index].deliveryMaterialsFee;
  1116. };
  1117. const openUpload = ref(false);
  1118. const loadingUpload = ref(false);
  1119. const clickUploadProduct = () => {
  1120. loadingUpload.value = false;
  1121. openUpload.value = true;
  1122. };
  1123. const giveawayServerLog = (params) => {
  1124. let file = params.file;
  1125. let formFile = new FormData();
  1126. formFile.append("file", file);
  1127. loadingUpload.value = true;
  1128. proxy.postUploadFile("/skuSpec/getSkuSpecListFromImport", formFile).then(
  1129. (res) => {
  1130. ElMessage({ message: "导入成功", type: "success" });
  1131. openUpload.value = false;
  1132. if (res.data && res.data.length > 0) {
  1133. for (let i = 0; i < res.data.length; i++) {
  1134. let list = formData.data.orderSkuList.filter((item) => item.skuSpecId === res.data[i].id && item.bomSpecId === res.data[i].bomSpecId);
  1135. if (!(list && list.length > 0)) {
  1136. let orderSkuBomList = [];
  1137. if (res.data[i].packagingMaterialList && res.data[i].packagingMaterialList.length > 0) {
  1138. orderSkuBomList = res.data[i].packagingMaterialList.map((item) => {
  1139. return {
  1140. bomSpecId: item.bomSpecId,
  1141. unitPrice: item.internalSellingPrice,
  1142. quantity: item.quantity,
  1143. bomSpecName: item.name,
  1144. };
  1145. });
  1146. }
  1147. formData.data.orderSkuList.push({
  1148. wlnSkuName: res.data[i].wlnSkuName,
  1149. skuId: res.data[i].skuId,
  1150. code: res.data[i].code,
  1151. name: res.data[i].name,
  1152. skuSpecId: res.data[i].id,
  1153. bomSpecId: res.data[i].bomSpecId,
  1154. quantity: undefined,
  1155. erpCode: "",
  1156. featureCode: "",
  1157. customProcessingFee: "",
  1158. customProcessingType: "",
  1159. lssueFee: "",
  1160. deliveryMaterialsFee: "",
  1161. packingLabor: "",
  1162. managementFee: "",
  1163. unitPrice: "",
  1164. printType: 1,
  1165. packageRemark: "",
  1166. orderSkuBomList: orderSkuBomList,
  1167. blueprint: res.data[i].designImgUrl,
  1168. productionDocument: res.data[i].sharedFolder,
  1169. artworkLibraryId: "0",
  1170. inventoryQuantity: res.data[i].inventoryQuantity,
  1171. proofingFee: 0,
  1172. });
  1173. }
  1174. }
  1175. }
  1176. },
  1177. (err) => {
  1178. console.log(err);
  1179. loadingUpload.value = false;
  1180. }
  1181. );
  1182. };
  1183. // 向父组件暴露
  1184. defineExpose({ getFormData, handleSubmit, saveShippingPackage });
  1185. </script>
  1186. <style lang="scss" scoped>
  1187. ::v-deep(.el-input-number .el-input__inner) {
  1188. text-align: left;
  1189. }
  1190. :deep(.el-dialog) {
  1191. margin-top: 10px !important;
  1192. margin-bottom: 10px !important;
  1193. }
  1194. :deep(.ql-editor) {
  1195. height: auto;
  1196. }
  1197. :deep(.el-collapse-item__header) {
  1198. justify-content: center;
  1199. }
  1200. :deep(.el-collapse-item__arrow) {
  1201. margin: 0;
  1202. }
  1203. :deep(.el-table__cell) {
  1204. vertical-align: top;
  1205. }
  1206. :deep(.vertical-align) {
  1207. vertical-align: middle;
  1208. }
  1209. .shippingPackage {
  1210. .el-form-item {
  1211. margin-bottom: 0;
  1212. }
  1213. }
  1214. </style>