copy-baseForm.vue 86 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598
  1. <template>
  2. <el-form
  3. :model="ruleForm"
  4. status-icon
  5. :rules="rulesThis"
  6. ref="ruleForm"
  7. :size="'mini'"
  8. v-loading="loading"
  9. label-width="90px"
  10. >
  11. <el-row class="ddiv">
  12. <el-col :span="1" class="dtitle">
  13. <ul style="padding: 140px 0 0 0">
  14. <li>基</li>
  15. <li>础</li>
  16. <li>信</li>
  17. <li>息</li>
  18. </ul>
  19. </el-col>
  20. <el-col :span="23" class="dmain">
  21. <el-row>
  22. <el-col :span="12">
  23. <el-form-item label="业务公司" prop="company_id">
  24. <!-- <search-work-company-->
  25. <!-- :value="ruleForm.company_id"-->
  26. <!-- :placeholder="'业务公司'"-->
  27. <!-- :disabled="type === 'view' || type === 'editBase' || type === 'editCoin'"-->
  28. <!-- :size="'mini'"-->
  29. <!-- :isDetail="type !== 'add'"-->
  30. <!-- @searchChange="company_idsearchChange"-->
  31. <!-- />-->
  32. <el-input :value="type === 'add' ? getCompanyWithCode(ruleForm.companyNo).name : companyName" disabled />
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="12">
  36. <el-form-item label="供应商" prop="supplierNo">
  37. <search-supplier
  38. :value="ruleForm.supplierNo"
  39. :placeholder="'供应商'"
  40. :disabled="type === 'view' || type === 'editCoin'"
  41. :size="'mini'"
  42. :names="supplierName"
  43. :isDetail="type !== 'add'"
  44. :isp="this.type !== 'view'"
  45. @searchChange="supplierNosearchChange"
  46. />
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="12">
  50. <el-form-item label="商品分类" prop="cat_id">
  51. <!-- <search-sort-->
  52. <!-- :value="ruleForm.cat_id"-->
  53. <!-- :placeholder="'商品分类'"-->
  54. <!-- :disabled="type === 'view' || type === 'editBase' || type === 'editCoin'"-->
  55. <!-- :size="'mini'"-->
  56. <!-- :names="cat_id_name"-->
  57. <!-- :isDetail="type !== 'add'"-->
  58. <!-- @searchChange="goods_class_change"-->
  59. <!-- />-->
  60. <company-sort
  61. :value="ruleForm.cat_id"
  62. :placeholder="'商品分类'"
  63. :disabled="type !== 'add'"
  64. :size="'mini'"
  65. :names="cat_id_name"
  66. :isDetail="type !== 'add'"
  67. :company-no="ruleForm.company_id"
  68. @searchChange="goods_class_change"
  69. />
  70. </el-form-item>
  71. </el-col>
  72. <el-col :span="12">
  73. <el-form-item label="商品名称" prop="good_name">
  74. <el-input
  75. placeholder="商品名称"
  76. maxlength="100"
  77. :disabled="type === 'view' || type === 'editCoin'"
  78. v-model="ruleForm.good_name"
  79. ></el-input>
  80. </el-form-item>
  81. </el-col>
  82. <el-col :span="8">
  83. <el-form-item label="商品品牌" prop="brandid">
  84. <search-brand
  85. :value="ruleForm.brandid"
  86. :disabled="type === 'view' || type === 'editCoin'"
  87. :size="'mini'"
  88. :isDetail="type !== 'add'"
  89. :names="brand_name"
  90. :placeholder="'商品品牌'"
  91. @searchChange="brandidsearchChange"
  92. />
  93. </el-form-item>
  94. </el-col>
  95. <el-col :span="8">
  96. <el-form-item label="销售权限" prop="is_auth">
  97. <el-select
  98. v-model="ruleForm.is_auth"
  99. filterable
  100. clearable
  101. :disabled="type === 'view' || type === 'editCoin'"
  102. style="width: 100%"
  103. placeholder="销售权限"
  104. >
  105. <el-option
  106. v-for="group in options3"
  107. :key="group.id"
  108. :label="group.name"
  109. :value="group.id"
  110. />
  111. </el-select>
  112. </el-form-item>
  113. </el-col>
  114. <el-col :span="4">
  115. <el-form-item label="单位" prop="unit" label-width="60px">
  116. <search-unit
  117. :value="ruleForm.unit"
  118. :disabled="type === 'view' || type === 'editCoin'"
  119. :size="'mini'"
  120. :isDetail="type !== 'add'"
  121. :names="unit_name"
  122. :placeholder="'单位'"
  123. @searchChange="unitsearchChange"
  124. />
  125. </el-form-item>
  126. </el-col>
  127. <el-col :span="4">
  128. <el-form-item label="税点" prop="tax" label-width="60px">
  129. <search-tax
  130. :value="ruleForm.tax"
  131. :disabled="type === 'view' || type === 'editBase' || type === 'editCoin'"
  132. :size="'mini'"
  133. :isDetail="type !== 'add'"
  134. :placeholder="'税点'"
  135. @searchChange="taxsearchChange"
  136. />
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="8">
  140. <el-form-item label="专属类型" prop="is_exclusive">
  141. <search-exclusive
  142. :disabled="type === 'view' || type === 'editCoin'"
  143. style="width: 100%"
  144. :isDetail="type !== 'add'"
  145. :size="'mini'"
  146. placeholder="专属类型"
  147. :value="ruleForm.is_exclusive"
  148. @selectChange="exclusiveSearchChange"
  149. />
  150. </el-form-item>
  151. </el-col>
  152. <el-col :span="8">
  153. <el-form-item label="商品总重量" prop="weight" label-width="95px">
  154. <digital-input
  155. :values="ruleForm.weight"
  156. :name="'ruleForm.weight'"
  157. :placeholder="'商品总重量'"
  158. :min="0"
  159. :disabled="type === 'view' || type === 'editCoin'"
  160. :max="100000000000"
  161. :position="'right'"
  162. :precision="3"
  163. :size="'mini'"
  164. :controls="false"
  165. :append="'g'"
  166. @reschange="number_change($event, 'weight')"
  167. />
  168. </el-form-item>
  169. </el-col>
  170. <el-col :span="8">
  171. <el-form-item label="是否库存品" prop="is_stock" label-width="95px">
  172. <el-select
  173. v-model="ruleForm.is_stock"
  174. filterable
  175. clearable
  176. :disabled="type === 'view' || type === 'editBase' || type === 'editCoin' || type === 'edit'"
  177. style="width: 100%"
  178. @change="stock_change"
  179. placeholder="是否库存品"
  180. >
  181. <el-option
  182. v-for="group in options4"
  183. :key="group.id"
  184. :label="group.name"
  185. :value="group.id"
  186. />
  187. </el-select>
  188. </el-form-item>
  189. </el-col>
  190. <el-col :span="24" v-show="is_noble">
  191. <el-row>
  192. <el-col :span="8">
  193. <el-form-item label="贵金属重量" prop="noble_weight" label-width="95px">
  194. <digital-input
  195. :values="ruleForm.noble_weight"
  196. :placeholder="'贵金属重量'"
  197. :name="'ruleForm.noble_weight'"
  198. :min="0"
  199. :disabled="
  200. type === 'view' || type === 'editBase' || type === 'editCoin'
  201. "
  202. :max="100000000000"
  203. :position="'right'"
  204. :precision="3"
  205. :size="'mini'"
  206. :controls="false"
  207. :append="'g'"
  208. @reschange="number_change($event, 'noble_weight')"
  209. />
  210. </el-form-item>
  211. </el-col>
  212. <el-col :span="8">
  213. <el-form-item label="贵金属种类" prop="noble_metal" label-width="95px">
  214. <search-metal-kind
  215. :value="ruleForm.noble_metal"
  216. :disabled="
  217. type === 'view' || type === 'editBase' || type === 'editCoin'
  218. "
  219. :size="'mini'"
  220. :isDetail="type !== 'add'"
  221. :placeholder="'贵金属种类'"
  222. @searchChange="noble_metalsearchChange"
  223. />
  224. </el-form-item>
  225. </el-col>
  226. <el-col :span="8">
  227. <el-form-item
  228. label="启用实时金价"
  229. prop="is_gold_price"
  230. label-width="110px"
  231. >
  232. <el-select
  233. v-model="ruleForm.is_gold_price"
  234. filterable
  235. clearable
  236. :disabled="
  237. type === 'view' || type === 'editBase' || type === 'editCoin'
  238. "
  239. style="width: 100%"
  240. placeholder="启用实时金价"
  241. @change="is_goold_price_change"
  242. >
  243. <el-option
  244. v-for="group in options5"
  245. :key="group.id"
  246. :label="group.name"
  247. :value="group.id"
  248. />
  249. </el-select>
  250. </el-form-item>
  251. </el-col>
  252. <el-col :span="6">
  253. <el-form-item label="有无工差" prop="is_diff">
  254. <el-select
  255. v-model="ruleForm.is_diff"
  256. filterable
  257. clearable
  258. :disabled="
  259. type === 'view' || type === 'editBase' || type === 'editCoin'
  260. "
  261. style="width: 100%"
  262. placeholder="有无工差"
  263. >
  264. <el-option
  265. v-for="group in options8"
  266. :key="group.id"
  267. :label="group.name"
  268. :value="group.id"
  269. />
  270. </el-select>
  271. </el-form-item>
  272. </el-col>
  273. <el-col :span="10">
  274. <el-form-item label="配置要求" prop="config" label-width="85px">
  275. <el-select
  276. v-model="ruleForm.config"
  277. multiple
  278. :disabled="type === 'view'"
  279. style="width: 100%"
  280. placeholder="配置要求"
  281. >
  282. <el-option
  283. v-for="(item, index) in options9"
  284. :key="item + index"
  285. :label="item"
  286. :value="item"
  287. >
  288. </el-option>
  289. </el-select>
  290. </el-form-item>
  291. </el-col>
  292. <el-col :span="8">
  293. <el-form-item
  294. label="其他配置要求"
  295. prop="other_config"
  296. label-width="110px"
  297. >
  298. <el-input
  299. placeholder="其他配置要求"
  300. maxlength="100"
  301. :disabled="type === 'view'"
  302. v-model="ruleForm.other_config"
  303. >
  304. </el-input>
  305. </el-form-item>
  306. </el-col>
  307. </el-row>
  308. </el-col>
  309. <el-col :span="8">
  310. <el-form-item label="售后说明" prop="after_sales">
  311. <el-input
  312. type="textarea"
  313. :rows="4"
  314. :disabled="type === 'view' || type === 'editCoin'"
  315. placeholder="售后说明"
  316. v-model="ruleForm.after_sales"
  317. show-word-limit
  318. maxlength="1000"
  319. >
  320. </el-input>
  321. </el-form-item>
  322. </el-col>
  323. <el-col :span="8">
  324. <el-form-item label="商品备注" prop="good_remark">
  325. <el-input
  326. type="textarea"
  327. :rows="4"
  328. :disabled="type === 'view' || type === 'editCoin'"
  329. placeholder="商品备注"
  330. show-word-limit
  331. maxlength="250"
  332. v-model="ruleForm.good_remark"
  333. >
  334. </el-input>
  335. </el-form-item>
  336. </el-col>
  337. <el-col :span="8">
  338. <el-form-item label="工艺说明" prop="craft_desc">
  339. <el-input
  340. type="textarea"
  341. :disabled="type === 'view' || type === 'editCoin'"
  342. :rows="4"
  343. placeholder="工艺说明"
  344. show-word-limit
  345. maxlength="250"
  346. v-model="ruleForm.craft_desc"
  347. >
  348. </el-input>
  349. </el-form-item>
  350. </el-col>
  351. <el-col :span="8">
  352. <el-form-item label="是否定制" prop="good_type">
  353. <el-select
  354. v-model="ruleForm.good_type"
  355. filterable
  356. :disabled="type === 'view' || type === 'editCoin'"
  357. clearable
  358. style="width: 100%"
  359. placeholder="是否定制"
  360. @change="good_type_change"
  361. >
  362. <el-option
  363. v-for="group in options1"
  364. :key="group.id"
  365. :label="group.name"
  366. :value="group.id"
  367. />
  368. </el-select>
  369. </el-form-item>
  370. </el-col>
  371. <el-col :span="8" v-show="ruleForm.good_type === '1'">
  372. <el-form-item label="定制起订量" prop="moq" label-width="95px">
  373. <digital-input
  374. :values="ruleForm.moq"
  375. :placeholder="'定制起订量'"
  376. :name="'ruleForm.moq'"
  377. :min="0"
  378. :disabled="type === 'view' || type === 'editCoin'"
  379. :max="100000000000"
  380. :position="'right'"
  381. :precision="0"
  382. :size="'mini'"
  383. :controls="false"
  384. :append="''"
  385. @reschange="number_change($event, 'moq')"
  386. />
  387. </el-form-item>
  388. </el-col>
  389. <el-col :span="8" v-show="ruleForm.good_type === '1'">
  390. <el-form-item label="定制工期" prop="customized">
  391. <digital-input
  392. :values="ruleForm.customized"
  393. :placeholder="'定制工期'"
  394. :name="'ruleForm.customized'"
  395. :min="0"
  396. :disabled="type === 'view' || type === 'editCoin'"
  397. :max="100000000000"
  398. :position="'right'"
  399. :precision="0"
  400. :size="'mini'"
  401. :controls="false"
  402. :append="'天'"
  403. @reschange="number_change($event, 'customized')"
  404. />
  405. </el-form-item>
  406. </el-col>
  407. <el-col :span="8" v-show="ruleForm.is_stock === '1'">
  408. <el-form-item label="备库起订量" prop="stock_moq" label-width="95px">
  409. <digital-input
  410. :values="ruleForm.stock_moq"
  411. :placeholder="'备库起订量'"
  412. :min="0"
  413. :disabled="type === 'view' || type === 'editCoin'"
  414. :max="100000000000"
  415. :position="'right'"
  416. :precision="0"
  417. :size="'mini'"
  418. :controls="false"
  419. :append="''"
  420. @reschange="number_change($event, 'stock_moq')"
  421. />
  422. </el-form-item>
  423. </el-col>
  424. </el-row>
  425. <el-row>
  426. <el-col :span="24">
  427. <el-form-item label="售价凭证类型" prop="proof_type" label-width="120px">
  428. <el-radio-group v-model="ruleForm.proof_type" @change="set_proof_url()">
  429. <el-radio v-for="item in options" :key="item.value" :label="item.value">{{
  430. item.label
  431. }}</el-radio>
  432. </el-radio-group>
  433. <!-- <el-button class="fr" type="primary" @click="showVoucher = true"
  434. >查看历史凭证</el-button
  435. > -->
  436. </el-form-item>
  437. <el-form-item label="凭证文件" prop="proof_url">
  438. <ul class="shangchuan-ul">
  439. <li v-if="ruleForm.proof_type === '1'" class="shiping">
  440. <div v-if="video_url" class="clearfix">
  441. <el-popover placement="top" width="300" trigger="hover">
  442. <video width="275" controls class="fl">
  443. <source :src="video_url" type="video/mp4" />
  444. <source :src="video_url" type="video/avi" />
  445. 您的浏览器不支持Video标签。
  446. </video>
  447. <i
  448. class="el-icon-video-camera-solid hover"
  449. style="font-size: 18px"
  450. slot="reference"
  451. ></i>
  452. </el-popover>
  453. <el-link
  454. :underline="false"
  455. @click="deleteUrl('1')"
  456. type="warning"
  457. style="margin: 0 0 0 16px"
  458. >删除</el-link
  459. >
  460. </div>
  461. <div class="activity-upload" v-else>
  462. <div class="btnupload" style="position: relative">
  463. <i class="el-icon-plus avatar-uploader-icon"></i>
  464. <video-upload
  465. class="Upload"
  466. :disabled="type === 'view' || type === 'editCoin'"
  467. :accept="'.mp4,.avi'"
  468. :multiple="false"
  469. :uploadcondition="beforeVideoUpload"
  470. @UploadErrorEvent="UploadVideoEventproof_url"
  471. @UploadSuccessEvent="UploadSuccessVideoproof_url"
  472. />
  473. </div>
  474. <div class="txt-tips fl">
  475. <p>建议大小:小于10MB</p>
  476. <p>文件格式:.mp4,.avi</p>
  477. </div>
  478. </div>
  479. </li>
  480. <li v-if="ruleForm.proof_type === '2'" class="tupian">
  481. <div v-if="img_url" class="clearfix">
  482. <img
  483. style="width: 50px; height: 50px"
  484. :src="img_url"
  485. class="avatar fl"
  486. />
  487. <el-link
  488. :underline="false"
  489. @click="deleteUrl('2')"
  490. type="warning"
  491. style="margin: 0 0 0 16px"
  492. >删除</el-link
  493. >
  494. </div>
  495. <div class="activity-upload" v-else>
  496. <div class="btnupload" style="position: relative">
  497. <i class="el-icon-plus avatar-uploader-icon"></i>
  498. <file-upload
  499. class="Upload"
  500. :disabled="type === 'view' || type === 'editCoin'"
  501. :accept="'.jpg,.png,.jpeg'"
  502. :multiple="false"
  503. :uploadcondition="beforeAvatarUpload"
  504. @UploadErrorEvent="UploadErrorEventproof_url"
  505. @UploadSuccessEvent="UploadSuccessEventproof_url"
  506. ></file-upload>
  507. </div>
  508. <div class="txt-tips fl">
  509. <p>建议大小:小于1MB</p>
  510. <p>文件格式:.jpg,.png,.jpeg</p>
  511. </div>
  512. </div>
  513. </li>
  514. <li v-if="ruleForm.proof_type === '3'" class="qita">
  515. <div v-if="other_url" class="clearfix">
  516. <a :href="other_url" download="凭证文件">点击下载</a>
  517. <el-link
  518. :underline="false"
  519. @click="deleteUrl('3')"
  520. type="warning"
  521. style="margin: 0 0 0 16px"
  522. >删除</el-link
  523. >
  524. </div>
  525. <div class="activity-upload" v-else>
  526. <div class="btnupload" style="position: relative">
  527. <i class="el-icon-plus avatar-uploader-icon"></i>
  528. <file-upload-pdf
  529. class="Upload"
  530. :accept="'.xlsx,.xls,.pdf,.zip,.rar,.7z'"
  531. :multiple="false"
  532. :uploadcondition="beforeOtherUpload"
  533. @UploadErrorEvent="UploadErrorOtherproof_url"
  534. @UploadSuccessEvent="UploadSuccessOtherproof_url"
  535. />
  536. </div>
  537. <div class="txt-tips fl">
  538. <p>建议大小:小于5MB</p>
  539. <p>文件格式:.xlsx,.xls,.pdf,.zip,.rar,.7z</p>
  540. </div>
  541. </div>
  542. </li>
  543. </ul>
  544. </el-form-item>
  545. <show-voucher-model
  546. :showModel="showVoucher"
  547. :id="spuCode"
  548. @cancel="showVoucher = false"
  549. @searchChange="resvoucher"
  550. />
  551. </el-col>
  552. </el-row>
  553. </el-col>
  554. </el-row>
  555. <el-row class="ddiv">
  556. <el-col :span="1" class="dtitle">
  557. <ul>
  558. <li>规</li>
  559. <li>格</li>
  560. <li>信</li>
  561. <li>息</li>
  562. </ul>
  563. </el-col>
  564. <el-col :span="23" class="dmain" style="padding: 20px 0 20px 18px">
  565. <el-table :data="spec_tableData" :size="'mini'" border style="width: 100%">
  566. <el-table-column prop="spec_value" label="规格类型" />
  567. <el-table-column prop="spec_value_value" label="规格值" />
  568. <el-table-column
  569. fixed="right"
  570. v-if="type === 'add' || type === 'editBase' || type === 'edit'"
  571. >
  572. <template slot="header" slot-scope="scope">
  573. <span>操作</span>
  574. <el-tooltip
  575. class="item"
  576. effect="dark"
  577. content="添加规格类型"
  578. placement="top"
  579. >
  580. <i
  581. class="el-icon-circle-plus-outline fr"
  582. style="font-size: 18px; margin-top: 2px"
  583. @click="openEdit('-1', {})"
  584. />
  585. </el-tooltip>
  586. </template>
  587. <template slot-scope="scope">
  588. <el-tooltip effect="dark" content="修改" placement="top">
  589. <i
  590. class="el-icon-edit tb-icon"
  591. @click="openEdit(scope.$index, scope.row)"
  592. ></i>
  593. </el-tooltip>
  594. <el-tooltip
  595. v-if="!scope.row.isMust"
  596. effect="dark"
  597. content="删除"
  598. placement="top"
  599. >
  600. <i class="el-icon-delete tb-icon" @click="openDelete(scope.$index)"></i>
  601. </el-tooltip>
  602. </template>
  603. </el-table-column>
  604. </el-table>
  605. <!-- 弹窗 新增/修改 -->
  606. <base-form-add-edit
  607. :index="modelIndex"
  608. :show-model="showModel"
  609. :sitem="sitem"
  610. @refresh="refreshEdit"
  611. @cancel="showModel = false"
  612. />
  613. </el-col>
  614. </el-row>
  615. <el-row class="ddiv">
  616. <el-col :span="1" class="dtitle">
  617. <ul>
  618. <li>包</li>
  619. <li>装</li>
  620. <li>信</li>
  621. <li>息</li>
  622. </ul></el-col
  623. >
  624. <el-col :span="23" class="dmain">
  625. <el-row>
  626. <el-col :span="6">
  627. <el-form-item label="包装方式" prop="packing_way">
  628. <el-input
  629. placeholder="包装方式"
  630. :disabled="type === 'view' || type === 'editCoin'"
  631. v-model="ruleForm.packing_way"
  632. maxlength="250"
  633. />
  634. </el-form-item>
  635. </el-col>
  636. <el-col :span="6">
  637. <el-form-item label="装箱规格" prop="packing_spec">
  638. <el-input
  639. placeholder="装箱规格"
  640. :disabled="type === 'view' || type === 'editCoin'"
  641. v-model="ruleForm.packing_spec"
  642. maxlength="250"
  643. />
  644. </el-form-item>
  645. </el-col>
  646. <el-col :span="6">
  647. <el-form-item label="装箱重量" prop="packing_weight">
  648. <digital-input
  649. :values="ruleForm.packing_weight"
  650. :placeholder="'装箱重量'"
  651. :min="0"
  652. :name="'ruleForm.packing_weight'"
  653. :disabled="type === 'view' || type === 'editCoin'"
  654. :max="100000000000"
  655. :position="'right'"
  656. :precision="3"
  657. :size="'mini'"
  658. :controls="false"
  659. :append="'g'"
  660. @reschange="number_change($event, 'packing_weight')"
  661. />
  662. </el-form-item>
  663. </el-col>
  664. <el-col :span="6">
  665. <el-form-item label="装箱尺寸" prop="packing_size">
  666. <el-input
  667. placeholder="装箱尺寸"
  668. :disabled="type === 'view' || type === 'editCoin'"
  669. v-model="ruleForm.packing_size"
  670. maxlength="250"
  671. />
  672. </el-form-item>
  673. </el-col>
  674. <el-col :span="6">
  675. <el-form-item label="商品尺寸" prop="good_size">
  676. <el-input
  677. placeholder="商品尺寸"
  678. :disabled="type === 'view' || type === 'editCoin'"
  679. v-model="ruleForm.good_size"
  680. maxlength="250"
  681. />
  682. </el-form-item>
  683. </el-col>
  684. <el-col :span="6">
  685. <el-form-item label="商品条形码" prop="good_bar">
  686. <el-input
  687. placeholder="商品条形码"
  688. :disabled="type === 'view' || type === 'editCoin'"
  689. v-model="ruleForm.good_bar"
  690. type="number"
  691. :min="0"
  692. :max="9999999999999"
  693. :step="0"
  694. />
  695. </el-form-item>
  696. </el-col>
  697. <el-col :span="12">
  698. <el-form-item label="包装清单" prop="packing_list">
  699. <el-input
  700. placeholder="包装清单"
  701. :disabled="type === 'view' || type === 'editCoin'"
  702. v-model="ruleForm.packing_list"
  703. maxlength="250"
  704. />
  705. </el-form-item>
  706. </el-col>
  707. </el-row>
  708. </el-col>
  709. </el-row>
  710. <el-row class="ddiv">
  711. <el-col :span="1" class="dtitle">
  712. <ul>
  713. <li>发</li>
  714. <li>货</li>
  715. <li>信</li>
  716. <li>息</li>
  717. </ul></el-col
  718. >
  719. <el-col :span="23" class="dmain">
  720. <el-row>
  721. <el-col :span="6">
  722. <el-form-item label="供货区域" prop="supply_area">
  723. <el-select
  724. v-model="ruleForm.supply_area"
  725. filterable
  726. clearable
  727. :disabled="type === 'view' || type === 'editCoin'"
  728. style="width: 100%"
  729. placeholder="供货区域"
  730. >
  731. <el-option
  732. v-for="group in options6"
  733. :key="group.id"
  734. :label="group.name"
  735. :value="group.id"
  736. />
  737. </el-select>
  738. </el-form-item>
  739. </el-col>
  740. <el-col :span="6">
  741. <el-form-item label="物流时间" prop="delivery_day">
  742. <digital-input
  743. :values="ruleForm.delivery_day"
  744. :placeholder="'物流时间'"
  745. :min="0"
  746. :name="'ruleForm.delivery_day'"
  747. :disabled="type === 'view' || type === 'editCoin'"
  748. :max="100000000000"
  749. :position="'right'"
  750. :precision="0"
  751. :size="'mini'"
  752. :controls="false"
  753. :append="'天'"
  754. @reschange="number_change($event, 'delivery_day')"
  755. />
  756. </el-form-item>
  757. </el-col>
  758. <el-col :span="6">
  759. <el-form-item label="供货周期" prop="lead_time">
  760. <digital-input
  761. :values="ruleForm.lead_time"
  762. :placeholder="'物流时间'"
  763. :min="0"
  764. :name="'ruleForm.lead_time'"
  765. :disabled="type === 'view' || type === 'editCoin'"
  766. :max="100000000000"
  767. :position="'right'"
  768. :precision="0"
  769. :size="'mini'"
  770. :controls="false"
  771. :append="'天'"
  772. @reschange="number_change($event, 'lead_time')"
  773. />
  774. </el-form-item>
  775. </el-col>
  776. <el-col :span="6">
  777. <el-form-item label="调样周期" prop="sample_day">
  778. <digital-input
  779. :values="ruleForm.sample_day"
  780. :placeholder="'调样周期'"
  781. :min="0"
  782. :name="'ruleForm.sample_day'"
  783. :disabled="type === 'view' || type === 'editCoin'"
  784. :max="100000000000"
  785. :position="'right'"
  786. :precision="0"
  787. :size="'mini'"
  788. :controls="false"
  789. :append="'天'"
  790. @reschange="number_change($event, 'sample_day')"
  791. />
  792. </el-form-item>
  793. </el-col>
  794. <el-col :span="12">
  795. <el-form-item label="发货地" prop="delivery_place">
  796. <select-area
  797. :placeholder="'发货地'"
  798. :value="ruleForm.delivery_place"
  799. :is-detail="id !== 'add'"
  800. :disabled="type === 'view' || type === 'editCoin'"
  801. :size="'mini'"
  802. @selectChange="selectAreaChange($event, 'delivery_place')"
  803. />
  804. </el-form-item>
  805. </el-col>
  806. <el-col :span="12">
  807. <el-form-item label="产地" prop="origin_place">
  808. <select-area
  809. :placeholder="'产地'"
  810. :value="ruleForm.origin_place"
  811. :size="'mini'"
  812. :is-detail="id !== 'add'"
  813. :disabled="type === 'view' || type === 'editCoin'"
  814. @selectChange="selectAreaChange($event, 'origin_place')"
  815. />
  816. </el-form-item>
  817. </el-col>
  818. </el-row>
  819. </el-col>
  820. </el-row>
  821. <el-row class="ddiv">
  822. <el-col :span="1" class="dtitle">
  823. <ul>
  824. <li>图</li>
  825. <li>片</li>
  826. <li>信</li>
  827. <li>息</li>
  828. </ul></el-col
  829. >
  830. <el-col :span="23" class="dmain">
  831. <el-row style="padding: 0 0 20px 0">
  832. <el-col :span="6">
  833. <el-form-item
  834. label="商品缩略"
  835. prop="good_thumb_img"
  836. class="activity-upload my-label-top"
  837. >
  838. <div class="btnupload" style="position: relative">
  839. <img
  840. v-if="ruleForm.good_thumb_img"
  841. :src="ruleForm.good_thumb_img"
  842. class="avatar"
  843. />
  844. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  845. <file-upload
  846. class="Upload"
  847. :disabled="type === 'view' || type === 'editCoin'"
  848. :accept="'.jpg,.png,.jpeg'"
  849. :multiple="true"
  850. :uploadcondition="beforeAvatarUpload"
  851. @UploadErrorEvent="UploadErrorEvent($event, 'good_thumb_img')"
  852. @UploadSuccessEvent="UploadSuccessEvent($event, 'good_thumb_img')"
  853. ></file-upload>
  854. </div>
  855. <div class="txt-tips fl">
  856. <p>尺寸比例:</p>
  857. <p>1:1</p>
  858. </div>
  859. </el-form-item>
  860. </el-col>
  861. <el-col :span="9">
  862. <el-form-item label="商品主图" prop="good_img">
  863. <div class="good_info_img_div">
  864. <ul v-if="ruleForm.good_img" class="clear">
  865. <li
  866. class="img-show-li"
  867. v-viewer
  868. v-for="(img, iindex) in ruleForm.good_img"
  869. :key="img + iindex"
  870. >
  871. <div class="img-show-li-div">
  872. <img :src="img" class="img-show" alt="" />
  873. <i
  874. v-if="type == 'add' || type === 'editBase' || type === 'edit'"
  875. class="el-icon-close"
  876. @click="closeImg(iindex, 'good_img')"
  877. ></i>
  878. </div>
  879. </li>
  880. <li
  881. class="img-show-li"
  882. v-if="
  883. ruleForm.good_img.length < 11 &&
  884. (type == 'add' || type === 'editBase' || type === 'edit')
  885. "
  886. >
  887. <div class="activity-upload">
  888. <div class="btnupload" style="position: relative">
  889. <i class="el-icon-plus avatar-uploader-icon"></i>
  890. <file-upload
  891. class="Upload"
  892. :disabled="type === 'view' || type === 'editCoin'"
  893. :accept="'.jpg,.png,.jpeg'"
  894. :multiple="true"
  895. :uploadcondition="beforeAvatarUpload"
  896. @UploadErrorEvent="UploadErrorEvent($event, 'good_img')"
  897. @UploadSuccessEvent="UploadSuccessEvent($event, 'good_img')"
  898. ></file-upload>
  899. </div>
  900. </div>
  901. </li>
  902. </ul>
  903. </div>
  904. </el-form-item>
  905. </el-col>
  906. <el-col :span="9">
  907. <el-form-item label="详情介绍" prop="good_info_img">
  908. <div class="good_info_img_div">
  909. <ul v-if="ruleForm.good_info_img" class="clear">
  910. <li
  911. class="img-show-li"
  912. v-viewer
  913. v-for="(img, iindex) in ruleForm.good_info_img"
  914. :key="img + iindex"
  915. >
  916. <div class="img-show-li-div">
  917. <img :src="img" class="img-show" alt="" />
  918. <i
  919. v-if="type == 'add' || type === 'editBase' || type === 'edit'"
  920. class="el-icon-close"
  921. @click="closeImg(iindex, 'good_info_img')"
  922. ></i>
  923. </div>
  924. </li>
  925. <li
  926. class="img-show-li"
  927. v-if="
  928. ruleForm.good_info_img.length < 11 &&
  929. (type == 'add' || type === 'editBase' || type === 'edit')
  930. "
  931. >
  932. <div class="activity-upload">
  933. <div class="btnupload" style="position: relative">
  934. <i class="el-icon-plus avatar-uploader-icon"></i>
  935. <file-upload
  936. class="Upload"
  937. :disabled="type === 'view' || type === 'editCoin'"
  938. :accept="'.jpg,.png,.jpeg'"
  939. :multiple="true"
  940. :uploadcondition="beforeAvatarUpload"
  941. @UploadErrorEvent="UploadErrorEvent($event, 'good_info_img')"
  942. @UploadSuccessEvent="
  943. UploadSuccessEvent($event, 'good_info_img')
  944. "
  945. ></file-upload>
  946. </div>
  947. </div>
  948. </li>
  949. </ul>
  950. </div>
  951. </el-form-item>
  952. </el-col>
  953. <el-col :span="24">
  954. <div style="font-size: 12px; color: #606266">
  955. <span style="padding: 0 0 0 20px">图片大小:小于1M</span>
  956. <span style="padding: 0 0 0 20px">图片类型.jpg/png/jpeg</span>
  957. </div>
  958. </el-col>
  959. </el-row>
  960. </el-col>
  961. </el-row>
  962. <el-row class="ddiv">
  963. <el-col :span="1" class="dtitle">
  964. <ul style="padding: 0">
  965. <li>固</li>
  966. <li>定</li>
  967. <li>与</li>
  968. <li>阶</li>
  969. <li>梯</li>
  970. <li>成</li>
  971. <li>本</li>
  972. </ul></el-col
  973. >
  974. <el-col :span="23" class="dmain">
  975. <el-row>
  976. <el-col :span="6">
  977. <el-form-item label="打样费" prop="demo_fee" label-width="75px">
  978. <digital-input
  979. :values="ruleForm.demo_fee"
  980. :placeholder="'打样费'"
  981. :min="0"
  982. :name="'ruleForm.demo_fee'"
  983. :disabled="type === 'view' || type === 'editBase'"
  984. :max="100000000000"
  985. :position="'right'"
  986. :precision="2"
  987. :size="'mini'"
  988. :controls="false"
  989. :append="'元'"
  990. @reschange="number_change($event, 'demo_fee')"
  991. />
  992. </el-form-item>
  993. </el-col>
  994. <el-col :span="6">
  995. <el-form-item label="开模费" prop="open_fee" label-width="75px">
  996. <digital-input
  997. :values="ruleForm.open_fee"
  998. :placeholder="'开模费'"
  999. :min="0"
  1000. :name="'ruleForm.open_fee'"
  1001. :disabled="type === 'view' || type === 'editBase'"
  1002. :max="100000000000"
  1003. :position="'right'"
  1004. :precision="2"
  1005. :size="'mini'"
  1006. :controls="false"
  1007. :append="'元/件'"
  1008. @reschange="number_change($event, 'open_fee')"
  1009. />
  1010. </el-form-item>
  1011. </el-col>
  1012. <el-col :span="6">
  1013. <el-form-item label="调样费" prop="sample_fee" label-width="75px">
  1014. <digital-input
  1015. :values="ruleForm.sample_fee"
  1016. :placeholder="'调样费'"
  1017. :min="0"
  1018. :name="'ruleForm.sample_fee'"
  1019. :disabled="type === 'view' || type === 'editBase'"
  1020. :max="100000000000"
  1021. :position="'right'"
  1022. :precision="2"
  1023. :size="'mini'"
  1024. :controls="false"
  1025. :append="'元'"
  1026. @reschange="number_change($event, 'sample_fee')"
  1027. />
  1028. </el-form-item>
  1029. </el-col>
  1030. <el-col :span="6">
  1031. <el-form-item label="市场价" prop="market_price" label-width="75px">
  1032. <digital-input
  1033. :values="ruleForm.market_price"
  1034. :placeholder="'市场价'"
  1035. :min="0"
  1036. :name="'ruleForm.market_price'"
  1037. :disabled="type === 'view' || type === 'editBase'"
  1038. :max="100000000000"
  1039. :position="'right'"
  1040. :precision="2"
  1041. :size="'mini'"
  1042. :controls="false"
  1043. :append="'元'"
  1044. @reschange="number_change($event, 'market_price')"
  1045. />
  1046. </el-form-item>
  1047. </el-col>
  1048. <!-- <el-col :span="6">
  1049. <el-form-item label="启用阶梯" prop="is_step">
  1050. <el-select
  1051. v-model="ruleForm.is_step"
  1052. filterable
  1053. :disabled="type === 'view' || type === 'editBase'"
  1054. style="width: 100%"
  1055. placeholder="启用阶梯"
  1056. @change="is_step_change"
  1057. >
  1058. <el-option
  1059. v-for="group in options5"
  1060. :key="group.id"
  1061. :label="group.name"
  1062. :value="group.id"
  1063. />
  1064. </el-select>
  1065. </el-form-item>
  1066. </el-col> -->
  1067. <el-col
  1068. :span="6"
  1069. v-show="is_noble && ruleForm && ruleForm.is_gold_price === '1'"
  1070. >
  1071. <el-form-item
  1072. label="供应商采购金价"
  1073. prop="cgd_gold_price"
  1074. label-width="130px"
  1075. >
  1076. <digital-input
  1077. :values="ruleForm.cgd_gold_price"
  1078. :placeholder="'供应商采购金价'"
  1079. :min="0"
  1080. :name="'ruleForm.cgd_gold_price'"
  1081. :disabled="type === 'view' || type === 'editBase'"
  1082. :max="100000000000"
  1083. :position="'right'"
  1084. :precision="2"
  1085. :size="'mini'"
  1086. :controls="false"
  1087. :append="'元/g'"
  1088. @reschange="number_change($event, 'cgd_gold_price')"
  1089. />
  1090. </el-form-item>
  1091. </el-col>
  1092. <el-col
  1093. :span="6"
  1094. v-show="is_noble && ruleForm && ruleForm.is_gold_price === '1'"
  1095. >
  1096. <el-form-item label="当前金价">
  1097. <el-input
  1098. v-model="ruleForm.noble_price"
  1099. disabled
  1100. maxlength="15"
  1101. placeholder="当前金价"
  1102. >
  1103. <template slot="append">元/g</template></el-input>
  1104. </el-form-item>
  1105. </el-col>
  1106. <el-col :span="24" style="padding-left: 18px">
  1107. <el-table
  1108. :data="ladder_tableData"
  1109. :size="'mini'"
  1110. border
  1111. stripe
  1112. style="width: 100%; margin: 0 0 20px 0"
  1113. >
  1114. <el-table-column prop="min_num" label="起订量(>=)" />
  1115. <el-table-column prop="nake_fee" label="成本单价" />
  1116. <el-table-column prop="cost_fee" label="工艺费" />
  1117. <el-table-column prop="delivery_fee" label="物流费" />
  1118. <el-table-column prop="cert_fee" label="证书费" />
  1119. <el-table-column prop="mark_fee" label="加标费" />
  1120. <el-table-column prop="package_fee" label="包装费" />
  1121. <el-table-column prop="other_fee" label="其他费用" />
  1122. <el-table-column prop="nake_total" label="成本合计" />
  1123. <el-table-column
  1124. fixed="right"
  1125. v-if="type === 'add' || type === 'editCoin' || type === 'edit'"
  1126. width="80px"
  1127. >
  1128. <template slot="header" slot-scope="scope">
  1129. <span>操作</span>
  1130. <el-tooltip effect="dark" content="添加阶梯" placement="top">
  1131. <i
  1132. class="el-icon-circle-plus-outline tb-icon fr"
  1133. @click="openCostEdit(-1, {})"
  1134. ></i>
  1135. </el-tooltip>
  1136. </template>
  1137. <template slot-scope="scope">
  1138. <el-tooltip effect="dark" content="修改" placement="top">
  1139. <i
  1140. class="el-icon-edit tb-icon"
  1141. @click="openCostEdit(scope.$index, scope.row)"
  1142. ></i>
  1143. </el-tooltip>
  1144. <el-tooltip effect="dark" content="删除" placement="top">
  1145. <i
  1146. class="el-icon-delete tb-icon"
  1147. @click="openCostEditDelete(scope.$index)"
  1148. ></i>
  1149. </el-tooltip>
  1150. </template>
  1151. </el-table-column>
  1152. </el-table>
  1153. </el-col>
  1154. </el-row>
  1155. <!-- 弹窗 新增/修改 -->
  1156. <cost-form-add-edit
  1157. :index="costmodelIndex"
  1158. :show-model="costshowModel"
  1159. :sitem="costsitem"
  1160. @refresh="costrefreshEdit"
  1161. @cancel="costshowModel = false"
  1162. />
  1163. </el-col>
  1164. <el-col
  1165. :span="24"
  1166. v-if="
  1167. type === 'editBase' || type === 'add' || type === 'editCoin' || type === 'edit'
  1168. "
  1169. style="text-align: right; padding: 15px 0 15px 0; border-top: 1px solid #dcdfe6"
  1170. >
  1171. <el-button :size="'mini'" type="primary" @click="submitForm">保 存 </el-button>
  1172. </el-col></el-row
  1173. >
  1174. </el-form>
  1175. </template>
  1176. <script>
  1177. import asyncRequest from "@/apis/service/goodStore/goodsCost";
  1178. import resToken from "@/mixins/resToken";
  1179. import { mapGetters } from "vuex";
  1180. import baseFormAddEdit from "./baseFormAddEdit";
  1181. import costFormAddEdit from "./costFormAddEdit";
  1182. import companyHelper from '@/mixins/companyHelper'
  1183. import {
  1184. options1,
  1185. options2,
  1186. options3,
  1187. options4,
  1188. options5,
  1189. options6,
  1190. options7,
  1191. options8,
  1192. options9,
  1193. rules as _rule,
  1194. } from "../columns";
  1195. import { add_sum, accMul } from "@/utils/validate";
  1196. import CompanySort from '@/components/globalComponents/company-sort/index.vue'
  1197. import { replaceTextWrapAndSpace } from "@/utils";
  1198. const rules = {
  1199. ..._rule,
  1200. proof_type: [
  1201. {
  1202. required: true,
  1203. message: "请选择凭证类型",
  1204. trigger: "change",
  1205. },
  1206. ],
  1207. proof_url: [
  1208. {
  1209. required: true,
  1210. message: "请上传凭证文件",
  1211. trigger: "blur,change",
  1212. },
  1213. ]
  1214. }
  1215. export default {
  1216. name: "goodsCostAdd",
  1217. mixins: [resToken, companyHelper],
  1218. props: ["showModel", "id", "type", "sitem", "business_companyNo"],
  1219. components: {
  1220. CompanySort,
  1221. baseFormAddEdit,
  1222. costFormAddEdit,
  1223. },
  1224. computed: {
  1225. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  1226. powers() {
  1227. const { btnList } = this.$store.getters
  1228. const tran = btnList.find((i) => i.menu_route == "goodsCostAdd") || {};
  1229. const { action } = tran ?? {};
  1230. return action ?? [];
  1231. },
  1232. },
  1233. watch: {
  1234. newTime: function (val) {
  1235. if (val) {
  1236. this.initForm();
  1237. }
  1238. },
  1239. },
  1240. data() {
  1241. return {
  1242. video_url: '',
  1243. img_url: '',
  1244. other_url: '',
  1245. companyName: '',
  1246. spec_tableData: [],
  1247. is_support_stock: "",
  1248. cat_id_name: "",
  1249. brand_name: "",
  1250. unit_name: "",
  1251. costshowModel: false,
  1252. costmodelIndex: "",
  1253. costsitem: {},
  1254. showModel: false,
  1255. modelIndex: "",
  1256. is_noble: false,
  1257. size: "small",
  1258. status: "",
  1259. rulesThis:this.rules,
  1260. activeName: "1",
  1261. loading: true,
  1262. supplierName: "",
  1263. options1: options1,
  1264. options2: options2,
  1265. options3: options3,
  1266. options4: options4,
  1267. options5: options5,
  1268. options6: options6,
  1269. options7: options7,
  1270. options8: options8,
  1271. options9: options9,
  1272. options: [
  1273. {
  1274. value: "1",
  1275. label: "视频",
  1276. },
  1277. {
  1278. value: "2",
  1279. label: "图片",
  1280. },
  1281. {
  1282. value: "3",
  1283. label: "其他",
  1284. },
  1285. ],
  1286. ruleForm: {
  1287. company_id:''
  1288. },
  1289. spec_tableData: [],
  1290. old_spec_tableData: [],
  1291. ladder_tableData: [],
  1292. old_ladder_tableData: [],
  1293. rules: rules,
  1294. };
  1295. },
  1296. mounted() {
  1297. this.initForm();
  1298. },
  1299. methods: {
  1300. resvoucher(e) {
  1301. const { proof_type, proof_url } = e;
  1302. this.ruleForm.proof_type = proof_type || "1";
  1303. switch (this.ruleForm.proof_type) {
  1304. case "1":
  1305. this.video_url = proof_url;
  1306. break;
  1307. case "2":
  1308. this.img_url = proof_url;
  1309. break;
  1310. case "3":
  1311. this.other_url = proof_url;
  1312. break;
  1313. default:
  1314. this.video_url = proof_url;
  1315. }
  1316. this.set_proof_url();
  1317. },
  1318. //图片上传成功
  1319. async UploadSuccessEventproof_url(data) {
  1320. const { url } = data;
  1321. if (url === "noToken") {
  1322. await this.logout();
  1323. } else {
  1324. this.img_url = url;
  1325. this.set_proof_url();
  1326. this.$message.success("图片上传成功!");
  1327. }
  1328. },
  1329. //图片上传失败
  1330. UploadErrorEventproof_url(res) {
  1331. if (res !== "break") {
  1332. this.set_proof_url();
  1333. this.$message.error("图片上传失败!");
  1334. }
  1335. },
  1336. //判断图片规格
  1337. beforeAvatarUpload(file) {
  1338. let isJPG = false;
  1339. if (
  1340. file.type === "image/jpg" ||
  1341. file.type === "image/png" ||
  1342. file.type === "image/jpeg"
  1343. ) {
  1344. isJPG = true;
  1345. }
  1346. const isLt2M = file.size / 1024 / 1024 < 1;
  1347. if (!isJPG) {
  1348. this.$message.error("图片格式不正确!");
  1349. }
  1350. if (!isLt2M) {
  1351. this.$message.error("图片大小不能超过 1MB!");
  1352. }
  1353. return isJPG && isLt2M;
  1354. },
  1355. //视频上传成功
  1356. async UploadSuccessVideoproof_url(data) {
  1357. const { url } = data;
  1358. if (url === "noToken") {
  1359. await this.logout();
  1360. } else {
  1361. this.video_url = url;
  1362. this.set_proof_url();
  1363. this.$message.success("视频上传成功!");
  1364. }
  1365. },
  1366. //视频上传失败
  1367. UploadErrorVideoproof_url(res) {
  1368. if (res !== "break") {
  1369. this.set_proof_url();
  1370. this.$message.error("视频上传失败!");
  1371. }
  1372. },
  1373. //判断视频规格
  1374. beforeVideoUpload(file) {
  1375. let isJPG = false;
  1376. if (file.type === "video/mp4" || file.type === "video/avi") {
  1377. isJPG = true;
  1378. }
  1379. const isLt2M = file.size / 1024 / 1024 < 10;
  1380. if (!isJPG) {
  1381. this.$message.error("视频格式不正确!");
  1382. }
  1383. if (!isLt2M) {
  1384. this.$message.error("视频大小不能超过 10MB!");
  1385. }
  1386. return isJPG && isLt2M;
  1387. },
  1388. // 其他文件上传成功
  1389. async UploadSuccessOtherproof_url(data) {
  1390. const { url } = data;
  1391. if (url === "noToken") {
  1392. await this.logout();
  1393. } else {
  1394. this.other_url = url;
  1395. this.set_proof_url();
  1396. this.$message.success("文件成功!");
  1397. }
  1398. },
  1399. //其他文件上传失败
  1400. UploadErrorOtherproof_url(res) {
  1401. if (res !== "break") {
  1402. this.set_proof_url();
  1403. this.$message.error("文件上传失败!");
  1404. }
  1405. },
  1406. //判断其他文件规格
  1407. beforeOtherUpload(file) {
  1408. console.log(file);
  1409. let isJPG = false;
  1410. if (
  1411. file.type === "application/vnd.ms-excel" ||
  1412. file.type ===
  1413. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
  1414. file.type === "application/pdf" ||
  1415. file.type === "application/x-zip-compressed"
  1416. ) {
  1417. isJPG = true;
  1418. }
  1419. let name = file.name;
  1420. let list = name.split(".");
  1421. if (list[list.length - 1] === "rar" || list[list.length - 1] === "7z") {
  1422. isJPG = true;
  1423. }
  1424. const isLt2M = file.size / 1024 / 1024 < 5;
  1425. if (!isJPG) {
  1426. this.$message.error("文件格式不正确!");
  1427. }
  1428. if (!isLt2M) {
  1429. this.$message.error("文件大小不能超过 5MB!");
  1430. }
  1431. return isJPG && isLt2M;
  1432. },
  1433. deleteUrl(type) {
  1434. switch (type) {
  1435. case "1":
  1436. this.video_url = "";
  1437. break;
  1438. case "2":
  1439. this.img_url = "";
  1440. break;
  1441. case "3":
  1442. this.other_url = "";
  1443. break;
  1444. default:
  1445. this.video_url = "";
  1446. }
  1447. this.set_proof_url();
  1448. },
  1449. set_proof_url() {
  1450. const { proof_type } = this.ruleForm;
  1451. switch (proof_type) {
  1452. case "1":
  1453. this.ruleForm.proof_url = this.video_url;
  1454. break;
  1455. case "2":
  1456. this.ruleForm.proof_url = this.img_url;
  1457. break;
  1458. case "3":
  1459. this.ruleForm.proof_url = this.other_url;
  1460. break;
  1461. default:
  1462. this.ruleForm.proof_url = this.video_url;
  1463. }
  1464. this.$refs.ruleForm.validateField("proof_url");
  1465. },
  1466. onCompanyChange(){ //MARK
  1467. if(this.type === 'add'){
  1468. this.ruleForm.company_id = this.currentCompany
  1469. }
  1470. },
  1471. async initForm() {
  1472. this.loading = true;
  1473. this.resetFormData();
  1474. this.rulesThis = this.rules;
  1475. await this.resetForm();
  1476. this.sch_is_noble();
  1477. this.good_type_change();
  1478. await this.get_golpricelast();
  1479. this.stock_change();
  1480. this.loading = false;
  1481. },
  1482. async number_change(e, key) {
  1483. this.ruleForm[key] = e + "" || "0";
  1484. this.$refs.ruleForm && this.$refs.ruleForm.validateField(key);
  1485. await this.get_all_fee();
  1486. },
  1487. openEdit(index, sitem) {
  1488. this.modelIndex = index;
  1489. this.sitem = sitem;
  1490. this.showModel = true;
  1491. },
  1492. stock_change() {
  1493. this.rulesThis.stock_moq[0].required = this.ruleForm.is_stock === "1";
  1494. },
  1495. openCostEdit(index, sitem) {
  1496. // const { is_step } = this.ruleForm;
  1497. // if (index === -1 && is_step === "0" && this.ladder_tableData.length > 0) {
  1498. // this.$message.warning("不启用阶梯成本,只能录入一条阶梯成本信息!");
  1499. // return;
  1500. // }
  1501. this.costmodelIndex = index;
  1502. this.costsitem = sitem;
  1503. this.costshowModel = true;
  1504. },
  1505. openDelete(index) {
  1506. this.spec_tableData.splice(index, 1);
  1507. },
  1508. openCostEditDelete(index) {
  1509. this.ladder_tableData.splice(index, 1);
  1510. },
  1511. // is_step_change() {
  1512. // const { is_step } = this.ruleForm;
  1513. // if (is_step === "0") {
  1514. // let res = [];
  1515. // let list =
  1516. // this.ladder_tableData.length === 0
  1517. // ? []
  1518. // : JSON.parse(JSON.stringify(this.ladder_tableData));
  1519. // if (list.length > 0) {
  1520. // res.push(list[0]);
  1521. // }
  1522. // this.ladder_tableData = res;
  1523. // }
  1524. // },
  1525. async submitForm() {
  1526. this.sch_is_noble();
  1527. this.good_type_change();
  1528. this.ruleForm.good_remark = replaceTextWrapAndSpace(this.ruleForm.good_remark)
  1529. this.ruleForm.craft_desc = replaceTextWrapAndSpace(this.ruleForm.craft_desc)
  1530. this.ruleForm.after_sales = replaceTextWrapAndSpace(this.ruleForm.after_sales)
  1531. await this.$refs.ruleForm.validate(async (valid) => {
  1532. if (valid) {
  1533. if (!this.loading) {
  1534. this.loading = true;
  1535. const {
  1536. noble_weight,
  1537. weight,
  1538. good_type,
  1539. moq,
  1540. is_step,
  1541. is_gold_price,
  1542. stock_moq,
  1543. is_stock,
  1544. supplierNo,
  1545. company_id,
  1546. } = this.ruleForm;
  1547. if (supplierNo.toString() === company_id) {
  1548. this.$message.warning("供应商不能与业务公司相同!");
  1549. loading = false;
  1550. return;
  1551. }
  1552. if (this.is_support_stock + "" === "0" && is_stock === "0") {
  1553. this.$message.warning("该商品为供应商退货业务创建的,不允许改为非库存品!");
  1554. loading = false;
  1555. return;
  1556. }
  1557. if (is_stock === "0") {
  1558. const { scode, sdata, smsg } = await this.getSupplerPower();
  1559. if (scode === 0) {
  1560. const { has_account } = sdata;
  1561. if (has_account + "" === "1") {
  1562. this.$message.warning("该供应商已开通账号,不允许创建非库存商品!");
  1563. this.loading = false;
  1564. return;
  1565. }
  1566. }
  1567. }
  1568. if (this.spec_tableData.length === 0) {
  1569. this.$message.warning("请录入商品规格信息!");
  1570. this.loading = false;
  1571. return;
  1572. }
  1573. let isMust = true;
  1574. this.spec_tableData.forEach((e) => {
  1575. if (e.isMust && !e.spec_value_id) {
  1576. isMust = false;
  1577. }
  1578. });
  1579. if (!isMust) {
  1580. this.$message.warning("分类绑定的规格必须填写规格值!");
  1581. this.loading = false;
  1582. return;
  1583. }
  1584. if (this.ladder_tableData.length === 0) {
  1585. this.$message.warning("请录入阶梯成本!");
  1586. this.loading = false;
  1587. return;
  1588. }
  1589. // stock_moq
  1590. if (is_stock === "1") {
  1591. let min = parseInt(this.ladder_tableData[0].min_num),
  1592. smoq = parseInt(stock_moq);
  1593. this.ladder_tableData.forEach((si) => {
  1594. let n = parseInt(si.min_num);
  1595. min = n < min ? n : min;
  1596. });
  1597. // console.log(smoq, min, smoq < min);
  1598. if (smoq < min) {
  1599. this.$message.warning("备库起订量不能低于成本最低起订量!");
  1600. this.loading = false;
  1601. return;
  1602. }
  1603. }
  1604. // if (is_step === "0" && this.ladder_tableData.length > 1) {
  1605. // this.$message.warning("不启用阶梯成本,只能录入一条阶梯成本信息!");
  1606. // this.loading = false;
  1607. // return;
  1608. // }
  1609. if (this.is_noble) {
  1610. if (noble_weight * 1000 > weight * 1000) {
  1611. this.$message.warning("贵金属总重量不能大于商品总重量!");
  1612. this.loading = false;
  1613. return;
  1614. }
  1615. }
  1616. if (is_gold_price === "1" && this.is_noble) {
  1617. let is_p = true;
  1618. this.ladder_tableData.forEach((v) => {
  1619. if (v.nake_fee * 1 !== 0) {
  1620. is_p = false;
  1621. }
  1622. });
  1623. if (!is_p) {
  1624. this.$message.warning("启用实时金价的贵金属商品不能填写成本单价!");
  1625. this.loading = false;
  1626. return;
  1627. }
  1628. }
  1629. // if (good_type === "1") {
  1630. // let set_num = moq * 1;
  1631. // let isok = true;
  1632. // this.ladder_tableData.forEach((e) => {
  1633. // if (e.min_num * 1 < set_num) {
  1634. // isok = false;
  1635. // }
  1636. // });
  1637. // if (!isok) {
  1638. // this.$message.warning("阶梯成本的起订量不能小于定制起订量!");
  1639. // this.loading = false;
  1640. // return;
  1641. // }
  1642. // }
  1643. let model = JSON.parse(JSON.stringify(this.ruleForm));
  1644. model.cat_id = model.cat_id.toString();
  1645. model.brandid = model.brandid.toString();
  1646. model.supplierNo = model.supplierNo.toString();
  1647. model.delivery_place = model.delivery_place.toString();
  1648. model.origin_place = model.origin_place.toString();
  1649. model.good_info_img = model.good_info_img.toString();
  1650. model.good_img = model.good_img.toString();
  1651. model.unit = model.unit.toString();
  1652. model.speclist = JSON.parse(JSON.stringify(this.setResData(1)));
  1653. model.good_ladder = JSON.parse(JSON.stringify(this.setResData(2)));
  1654. model.config = model.config.toString();
  1655. model.is_exclusive =
  1656. model.is_exclusive.length > 0
  1657. ? model.is_exclusive[model.is_exclusive.length - 1]
  1658. : "";
  1659. let res = {};
  1660. delete model["id"];
  1661. if (this.type === "add") {
  1662. delete model["spuCode"];
  1663. res = await asyncRequest.add(model);
  1664. } else if (this.type === "editBase") {
  1665. let item1 = this.setModel(model, "1");
  1666. res = await asyncRequest.update(item1);
  1667. } else if (this.type === "editCoin") {
  1668. let item2 = this.setModel(model, "2");
  1669. res = await asyncRequest.updateP(item2);
  1670. } else {
  1671. model.companyNo = model.company_id;
  1672. delete model["company_id"];
  1673. res = await asyncRequest.edit_update(model);
  1674. }
  1675. // console.log(res);
  1676. this.loading = false;
  1677. const { code, data, message } = res;
  1678. if (code === 0) {
  1679. const title =
  1680. this.type === "add"
  1681. ? "新建成功!"
  1682. : this.type === "editBase"
  1683. ? "基础信息修改成功!"
  1684. : this.type === "editCoin"
  1685. ? "成本信息修改成功!"
  1686. : "商品信息修改成功";
  1687. this.$notify.success({
  1688. title: title,
  1689. message: "",
  1690. });
  1691. this.showModelThis = false;
  1692. // 刷新
  1693. this.$emit("refresh");
  1694. } else if (code >= 100 && code <= 104) {
  1695. await this.logout();
  1696. } else {
  1697. this.$message.warning(message);
  1698. }
  1699. }
  1700. } else {
  1701. // console.log("error submit!!");
  1702. return false;
  1703. }
  1704. });
  1705. },
  1706. //获取规格值
  1707. setResData(type) {
  1708. let list = JSON.parse(
  1709. JSON.stringify(type === 1 ? this.spec_tableData : this.ladder_tableData)
  1710. );
  1711. let oldlist = JSON.parse(
  1712. JSON.stringify(type === 1 ? this.old_spec_tableData : this.old_ladder_tableData)
  1713. );
  1714. let hasIDlist = [];
  1715. list.forEach((a) => {
  1716. if (a.id !== "") {
  1717. hasIDlist.push(a);
  1718. }
  1719. });
  1720. let newList = [];
  1721. let resList = [];
  1722. oldlist.forEach((a, ai) => {
  1723. let item = null;
  1724. let index = hasIDlist.findIndex((b) => a.id === b.id);
  1725. if (index === -1) {
  1726. item = JSON.parse(JSON.stringify(a));
  1727. item.is_del = "1";
  1728. } else {
  1729. item = JSON.parse(JSON.stringify(hasIDlist[index]));
  1730. }
  1731. newList.push(item);
  1732. });
  1733. list.forEach((b) => {
  1734. if (b.id === "") {
  1735. b.is_del = "0";
  1736. newList.push(b);
  1737. }
  1738. });
  1739. if (type === 1) {
  1740. newList.forEach((a) => {
  1741. let m = {
  1742. id: a.id,
  1743. spec_id: a.spec_id,
  1744. spec_value_id: a.spec_value_id,
  1745. is_del: a.is_del || "0",
  1746. };
  1747. resList.push(m);
  1748. });
  1749. } else {
  1750. newList.forEach((a) => {
  1751. let m = {
  1752. id: a.id,
  1753. min_num: a.min_num,
  1754. nake_fee: a.nake_fee,
  1755. cost_fee: a.cost_fee,
  1756. delivery_fee: a.delivery_fee,
  1757. cert_fee: a.cert_fee,
  1758. mark_fee: a.mark_fee,
  1759. package_fee: a.package_fee,
  1760. other_fee: a.other_fee,
  1761. is_del: a.is_del || "0",
  1762. };
  1763. resList.push(m);
  1764. });
  1765. }
  1766. return resList;
  1767. },
  1768. setladder() {
  1769. let list = JSON.parse(JSON.stringify(this.ladder_tableData));
  1770. let oldlist = JSON.parse(JSON.stringify(this.old_ladder_tableData));
  1771. let hasIDlist = [];
  1772. list.forEach((a) => {
  1773. if (a.id !== "") {
  1774. hasIDlist.push(a);
  1775. }
  1776. });
  1777. let newList = [];
  1778. let resList = [];
  1779. oldlist.forEach((a, ai) => {
  1780. let item = null;
  1781. let index = hasIDlist.findIndex((b) => a.id === b.id);
  1782. if (index === -1) {
  1783. item = JSON.parse(JSON.stringify(a));
  1784. item.is_del = "1";
  1785. } else {
  1786. item = JSON.parse(JSON.stringify(b));
  1787. }
  1788. newList.push(item);
  1789. });
  1790. list.forEach((b) => {
  1791. if (b.id === "") {
  1792. b.is_del = "0";
  1793. newList.push(b);
  1794. }
  1795. });
  1796. newList.forEach((a) => {
  1797. let m = {
  1798. id: a.id,
  1799. min_num: a.min_num,
  1800. spec_value_id: a.spec_value_id,
  1801. is_del: a.is_del || "0",
  1802. };
  1803. resList.push(m);
  1804. });
  1805. return resList;
  1806. },
  1807. //规格编辑修改
  1808. refreshEdit(e) {
  1809. let item = JSON.parse(JSON.stringify(e));
  1810. const {
  1811. index,
  1812. id,
  1813. spec_id,
  1814. isMust,
  1815. spec_value,
  1816. spec_value_id,
  1817. spec_value_value,
  1818. } = item;
  1819. let ffindex = -1;
  1820. this.spec_tableData.forEach((i, findex) => {
  1821. if (i.spec_id === spec_id) {
  1822. ffindex = findex;
  1823. this.spec_tableData[findex].id = id;
  1824. this.spec_tableData[findex].spec_id = spec_id;
  1825. // this.spec_tableData[findex].isMust = isMust;
  1826. this.spec_tableData[findex].spec_value = spec_value;
  1827. this.spec_tableData[findex].spec_value_id = spec_value_id;
  1828. this.spec_tableData[findex].spec_value_value = spec_value_value;
  1829. }
  1830. });
  1831. if (ffindex === -1) {
  1832. this.spec_tableData.push(item);
  1833. }
  1834. this.showModel = false;
  1835. },
  1836. //阶梯成本修改
  1837. async costrefreshEdit(e) {
  1838. let item = JSON.parse(JSON.stringify(e));
  1839. const {
  1840. index,
  1841. id,
  1842. cost_fee,
  1843. delivery_fee,
  1844. min_num,
  1845. nake_fee,
  1846. cert_fee,
  1847. mark_fee,
  1848. package_fee,
  1849. other_fee,
  1850. } = item;
  1851. let isok = true;
  1852. let ffindex = -1;
  1853. if (this.ladder_tableData && this.ladder_tableData.length === 0) {
  1854. this.ladder_tableData.push(item);
  1855. } else {
  1856. this.ladder_tableData.forEach((i, findex) => {
  1857. if (parseInt(min_num + "") === parseInt(i.min_num + "")) {
  1858. isok = false;
  1859. this.ladder_tableData[findex].id = id;
  1860. this.ladder_tableData[findex].min_num = min_num;
  1861. this.ladder_tableData[findex].cost_fee = cost_fee;
  1862. this.ladder_tableData[findex].delivery_fee = delivery_fee;
  1863. this.ladder_tableData[findex].nake_fee = nake_fee;
  1864. this.ladder_tableData[findex].cert_fee = cert_fee;
  1865. this.ladder_tableData[findex].mark_fee = mark_fee;
  1866. this.ladder_tableData[findex].package_fee = package_fee;
  1867. this.ladder_tableData[findex].other_fee = other_fee;
  1868. }
  1869. });
  1870. if (isok) {
  1871. this.ladder_tableData.forEach((i, findex) => {
  1872. if (findex === parseInt(index + "")) {
  1873. ffindex = findex;
  1874. this.ladder_tableData[findex].id = id;
  1875. this.ladder_tableData[findex].min_num = min_num;
  1876. this.ladder_tableData[findex].cost_fee = cost_fee;
  1877. this.ladder_tableData[findex].delivery_fee = delivery_fee;
  1878. this.ladder_tableData[findex].nake_fee = nake_fee;
  1879. this.ladder_tableData[findex].cert_fee = cert_fee;
  1880. this.ladder_tableData[findex].mark_fee = mark_fee;
  1881. this.ladder_tableData[findex].package_fee = package_fee;
  1882. this.ladder_tableData[findex].other_fee = other_fee;
  1883. }
  1884. });
  1885. if (ffindex === -1) {
  1886. this.ladder_tableData.push(item);
  1887. }
  1888. }
  1889. }
  1890. await this.get_all_fee();
  1891. this.showModel = false;
  1892. },
  1893. async get_golpricelast() {
  1894. const { noble_metal } = this.ruleForm;
  1895. if (noble_metal) {
  1896. let model = {
  1897. type: noble_metal,
  1898. };
  1899. const { code, data, message } = await asyncRequest.golpricelast(model);
  1900. if (code === 0) {
  1901. data.forEach((e) => {
  1902. if (e.type) {
  1903. this.ruleForm.noble_price = e.price;
  1904. }
  1905. });
  1906. } else if (code >= 100 && code <= 104) {
  1907. await this.logout();
  1908. } else {
  1909. this.$message.warning(message);
  1910. }
  1911. } else {
  1912. this.ruleForm.noble_price = "0";
  1913. }
  1914. },
  1915. async get_all_fee() {
  1916. await this.get_golpricelast();
  1917. this.ladder_tableData.forEach((si, sii) => {
  1918. this.ladder_tableData[sii].nake_total = this.count_fee(si);
  1919. this.$set(this.ladder_tableData, sii, this.ladder_tableData[sii]);
  1920. });
  1921. },
  1922. count_fee(e) {
  1923. const {
  1924. noble_price, //供应商采购金价
  1925. is_gold_price, //是否启用实时金价
  1926. noble_weight, //贵金属重量
  1927. } = this.ruleForm;
  1928. const {
  1929. nake_fee, //成本单价
  1930. cost_fee, //工艺费
  1931. delivery_fee, //物流费
  1932. cert_fee, //证书费
  1933. mark_fee, //加标费
  1934. package_fee, //包装费
  1935. other_fee, //其他费用
  1936. } = e;
  1937. let XA = add_sum(nake_fee, delivery_fee),
  1938. XB = add_sum(package_fee, cert_fee),
  1939. XC = add_sum(mark_fee, other_fee),
  1940. XD = 0;
  1941. let total = add_sum(add_sum(XA, XB), XC);
  1942. // console.log(total);
  1943. if (this.is_noble && is_gold_price === "1") {
  1944. XD = add_sum(accMul(noble_price, noble_weight), accMul(noble_weight, cost_fee));
  1945. total = add_sum(total, XD);
  1946. }
  1947. return total;
  1948. },
  1949. dataSort(key) {
  1950. return function (a, b) {
  1951. let value1 = a[key];
  1952. let value2 = b[key];
  1953. return value1 - value2;
  1954. };
  1955. },
  1956. async getSupplerPower() {
  1957. const { code, data, message } = await asyncRequest.supplerlist({
  1958. code: this.ruleForm.supplierNo[0],
  1959. is_platform: "",
  1960. name: "",
  1961. page: 1,
  1962. size: 1000,
  1963. });
  1964. return { scode: code, sdata: data, smsg: message };
  1965. },
  1966. resetFormData() {
  1967. this.is_support_stock = "1";
  1968. this.spec_tableData = [];
  1969. this.old_spec_tableData = [];
  1970. this.ladder_tableData = [];
  1971. this.old_ladder_tableData = [];
  1972. this.cat_id_name = "";
  1973. this.is_noble = false;
  1974. this.status = "";
  1975. this.brand_name = "";
  1976. this.unit_name = "";
  1977. this.supplierName = "";
  1978. this.ruleForm = {
  1979. proof_url:"",
  1980. proof_type:"1",
  1981. id: "",
  1982. spuCode: "",
  1983. cat_id: [],
  1984. brandid: [],
  1985. noble_weight: "0",
  1986. weight: "0",
  1987. good_type: "0",
  1988. is_stock: "0",
  1989. supplierNo: [],
  1990. company_id: "",
  1991. is_auth: "",
  1992. tax: "",
  1993. good_name: "",
  1994. unit: [],
  1995. is_exclusive: [],
  1996. noble_metal: "",
  1997. is_gold_price: "",
  1998. moq: "",
  1999. customized: "",
  2000. after_sales: "",
  2001. craft_desc: "",
  2002. good_remark: "",
  2003. //包装发货/图片
  2004. packing_list: "",
  2005. packing_way: "",
  2006. packing_spec: "",
  2007. packing_weight: "",
  2008. packing_size: "",
  2009. good_size: "",
  2010. good_bar: "",
  2011. supply_area: "",
  2012. delivery_place: [],
  2013. origin_place: [],
  2014. delivery_day: "0",
  2015. lead_time: "0",
  2016. sample_day: "0",
  2017. good_thumb_img: "",
  2018. good_img: [],
  2019. good_info_img: [],
  2020. //固定阶梯成本
  2021. demo_fee: "0",
  2022. open_fee: "0",
  2023. sample_fee: "0",
  2024. market_price: "0",
  2025. cgd_gold_price: "0",
  2026. noble_price: "0",
  2027. // is_step: "0",
  2028. is_diff: "",
  2029. config: [],
  2030. other_config: "",
  2031. stock_moq: "0",
  2032. };
  2033. },
  2034. async resetForm() {
  2035. // 重置
  2036. await this.$nextTick(async () => {
  2037. if (this.$refs.ruleForm) {
  2038. this.$refs.ruleForm.resetFields();
  2039. this.$refs.ruleForm.clearValidate();
  2040. this.spec_tableData = [];
  2041. this.old_spec_tableData = [];
  2042. this.ladder_tableData = [];
  2043. this.old_ladder_tableData = [];
  2044. const {
  2045. id,
  2046. companyName,
  2047. spuCode, //string 商品spuCode
  2048. // good_code, //string 无
  2049. good_name, //string 商品名称
  2050. // cat_id, //string 分类id
  2051. cat_info, //array 分类
  2052. brand_id, //string 品牌id
  2053. unit,
  2054. supplierName,
  2055. companyNo, // string 企业公司id
  2056. good_unit, // string 商品单位
  2057. good_type, //string 是否定制 1是0否
  2058. moq, //string 起订量
  2059. is_exclusive, // string 是否是专属
  2060. customized, // string 定制工期
  2061. tax, //string 税率
  2062. supplierNo, // string 供应商
  2063. is_auth, //string 是否有销售权限0 否1 是
  2064. auth_img, // string 无
  2065. exclusive,
  2066. is_stock, //
  2067. after_sales, // string 售后说明
  2068. craft_desc, // string 工艺说明
  2069. good_remark, // string 商品备注
  2070. weight, // string 重量
  2071. packing_way, // string 包装方式
  2072. packing_size, // string 包装尺寸
  2073. good_size, //商品尺寸
  2074. packing_spec, // string 包装规格
  2075. packing_list, // string 包装清单
  2076. packing_weight, // string 装箱重量
  2077. good_bar, // string 条形码
  2078. supply_area, // string 供货区域 1 全国2 除偏远地区
  2079. delivery_place, // string 发货地区
  2080. origin_place, // string 产地
  2081. delivery_day, // string 物流天数
  2082. lead_time, // string 供货周期
  2083. sample_day, //string 调样周期
  2084. sample_fee, // string 调样费有
  2085. good_img, // string 商品图片
  2086. good_thumb_img, // string 商品说略图
  2087. good_info_img, // string 商品详情图
  2088. demo_fee, // string 打样费
  2089. open_fee, // string 开模费
  2090. noble_metal, // string 金属类别
  2091. noble_weight, // string 金属重量
  2092. is_gold_price, // string 是否使用实时金价
  2093. market_price, // string 市场价
  2094. cgd_gold_price, // string 供应商采购金价
  2095. noble_price,
  2096. // is_step, // string 是否使用阶梯价
  2097. // is_online, // string 是否上线
  2098. status, // string 状态
  2099. nakelist, //阶梯成本
  2100. speclist, //商品规格
  2101. brand_name,
  2102. config,
  2103. is_diff,
  2104. other_config,
  2105. stock_moq,
  2106. is_support_stock,
  2107. proof_url,
  2108. proof_type
  2109. } = this.sitem;
  2110. this.companyName = companyName
  2111. this.is_support_stock = is_support_stock || "1";
  2112. let cat_id_name = "";
  2113. let cat_id = [];
  2114. (cat_info || []).forEach((ai, i) => {
  2115. cat_id_name += i === 0 ? ai.name : `_${ai.name}`;
  2116. cat_id.push(ai.id);
  2117. });
  2118. this.cat_id_name = cat_id_name;
  2119. let isok = false;
  2120. if (cat_id.length > 0) {
  2121. cat_id.forEach((i) => {
  2122. if (i === "6") {
  2123. isok = true;
  2124. }
  2125. });
  2126. }
  2127. let exclusiveList = [];
  2128. if (exclusive && exclusive.length > 0) {
  2129. exclusive.forEach((a, ai) => {
  2130. exclusiveList.push(a.id);
  2131. });
  2132. }
  2133. this.is_noble = isok;
  2134. let spec_list1 =
  2135. speclist && speclist.length > 0 ? JSON.parse(JSON.stringify(speclist)) : [];
  2136. spec_list1.forEach((a) => {
  2137. let model = {
  2138. id: a.id,
  2139. is_del: a.is_del,
  2140. spec_id: a.spec_id,
  2141. spec_value: a.spec_name,
  2142. spec_value_value: a.spec_value,
  2143. spec_value_id: a.spec_value_id,
  2144. spuCode: a.spuCode,
  2145. };
  2146. this.spec_tableData.push(model);
  2147. });
  2148. this.old_spec_tableData = JSON.parse(JSON.stringify(this.spec_tableData));
  2149. let list2 =
  2150. nakelist && nakelist.length > 0 ? JSON.parse(JSON.stringify(nakelist)) : [];
  2151. this.ladder_tableData = list2;
  2152. this.old_ladder_tableData = JSON.parse(JSON.stringify(this.ladder_tableData));
  2153. this.status = status;
  2154. this.brand_name = brand_name;
  2155. this.unit_name = unit;
  2156. this.supplierName = supplierName || "";
  2157. this.ruleForm = {
  2158. proof_url,
  2159. proof_type,
  2160. id: id || "",
  2161. spuCode: spuCode || "",
  2162. cat_id: cat_id && cat_id.length > 0 ? [cat_id[cat_id.length - 1]] : [],
  2163. brandid: brand_id ? [brand_id] : [],
  2164. noble_weight: noble_weight || "",
  2165. weight: weight || "",
  2166. good_type: good_type || "0",
  2167. is_stock: is_stock || "0",
  2168. supplierNo: supplierNo ? [supplierNo] : [],
  2169. company_id: companyNo,
  2170. is_auth: is_auth || "",
  2171. tax: tax ? tax + "%" : "",
  2172. good_name: good_name || "",
  2173. unit: good_unit ? [good_unit] : [],
  2174. is_exclusive: exclusiveList || [],
  2175. noble_metal: noble_metal || "",
  2176. is_gold_price: is_gold_price || "0",
  2177. moq: moq || "0",
  2178. customized: customized || "0",
  2179. after_sales: after_sales || "",
  2180. craft_desc: craft_desc || "",
  2181. good_remark: good_remark || "",
  2182. //包装发货/图片
  2183. packing_list: packing_list || "",
  2184. packing_way: packing_way || "",
  2185. packing_spec: packing_spec || "",
  2186. packing_weight: packing_weight || "",
  2187. packing_size: packing_size || "",
  2188. good_size: good_size || "",
  2189. good_bar: good_bar || "",
  2190. supply_area: supply_area || "",
  2191. delivery_place: delivery_place ? (delivery_place || "").split(",") : [],
  2192. origin_place: origin_place ? (origin_place || "").split(",") : [],
  2193. delivery_day: delivery_day || "",
  2194. lead_time: lead_time || "",
  2195. sample_day: sample_day || "",
  2196. good_thumb_img: good_thumb_img || "",
  2197. good_img: good_img
  2198. ? Object.prototype.toString.call(good_img) === "[object Array]"
  2199. ? []
  2200. : (good_img || "").split(",")
  2201. : [],
  2202. good_info_img: good_info_img
  2203. ? (Object.prototype.toString.call(good_info_img) === "[object Array]"
  2204. ? []
  2205. : good_info_img || ""
  2206. ).split(",")
  2207. : [],
  2208. //固定阶梯成本
  2209. demo_fee: demo_fee || "",
  2210. open_fee: open_fee || "",
  2211. sample_fee: sample_fee || "",
  2212. market_price: market_price || "",
  2213. cgd_gold_price: cgd_gold_price || "",
  2214. noble_price: noble_price || "0",
  2215. // is_step: is_step || "0",
  2216. is_diff: is_diff || "",
  2217. config: config ? config.split(",") : [],
  2218. other_config: other_config || "",
  2219. stock_moq: stock_moq || "0",
  2220. };
  2221. }
  2222. if(this.type === 'add') this.ruleForm.company_id = this.currentCompany
  2223. console.log(this.ruleForm)
  2224. await this.set_must_spec();
  2225. });
  2226. },
  2227. sch_is_noble() {
  2228. let list = [
  2229. "noble_weight",
  2230. "noble_metal",
  2231. "is_gold_price",
  2232. "is_diff",
  2233. "config",
  2234. "other_config",
  2235. "cgd_gold_price",
  2236. ];
  2237. for (let i = 0; i < list.length; i++) {
  2238. if (list[i] === "cgd_gold_price") {
  2239. const { is_gold_price } = this.ruleForm;
  2240. this.rulesThis[list[i]][0].required = this.is_noble && is_gold_price === "1";
  2241. // console.log(list[i] + "===" + this.rulesThis[list[i]][0].required);
  2242. } else {
  2243. this.rulesThis[list[i]][0].required = this.is_noble;
  2244. }
  2245. this.$refs.ruleForm.validateField(list[i]);
  2246. }
  2247. },
  2248. setModel(model, type) {
  2249. let item = null;
  2250. if (type === 1) {
  2251. item = JSON.parse(JSON.stringify(model));
  2252. delete item["demo_fee"];
  2253. delete item["open_fee"];
  2254. delete item["noble_metal"];
  2255. delete item["noble_weight"];
  2256. delete item["is_gold_price"];
  2257. delete item["market_price"];
  2258. delete item["cgd_gold_price"];
  2259. // delete item["is_step"];
  2260. delete item["good_ladder"];
  2261. } else {
  2262. const {
  2263. demo_fee,
  2264. open_fee,
  2265. noble_metal,
  2266. noble_weight,
  2267. is_gold_price,
  2268. market_price,
  2269. cgd_gold_price,
  2270. // is_step,
  2271. good_ladder,
  2272. spuCode,
  2273. } = model;
  2274. item = {
  2275. demo_fee: demo_fee || "",
  2276. open_fee: open_fee || "",
  2277. noble_metal: noble_metal || "",
  2278. noble_weight: noble_weight || "",
  2279. is_gold_price: is_gold_price || "",
  2280. market_price: market_price || "",
  2281. cgd_gold_price: cgd_gold_price || "",
  2282. // is_step: is_step || "",
  2283. good_ladder: good_ladder || [],
  2284. spuCode: spuCode || "",
  2285. };
  2286. }
  2287. return model;
  2288. },
  2289. //商品分类选择
  2290. async goods_class_change(e) {
  2291. const { is_gold, pid, id, label, cat_desc } = e;
  2292. this.spec_tableData = []
  2293. this.ruleForm.cat_id = id ? [id] : [];
  2294. this.$refs.ruleForm.validateField("cat_id");
  2295. this.ruleForm.after_sales = cat_desc || "";
  2296. this.$refs.ruleForm.validateField("after_sales");
  2297. this.is_noble = is_gold;
  2298. this.sch_is_noble();
  2299. await this.set_must_spec();
  2300. await this.get_all_fee();
  2301. },
  2302. async set_must_spec() {
  2303. const { cat_id } = this.ruleForm;
  2304. let id = cat_id.length == 1 ? cat_id[0] : "";
  2305. if (id) {
  2306. const { code, message, data } = await asyncRequest.catinfo({ id: id });
  2307. this.ruleForm.after_sales = data.cat_desc
  2308. this.$refs.ruleForm.validateField('after_sales');
  2309. const unionSpec = (spec) => {
  2310. const newArr = []
  2311. const map = new Map()
  2312. spec.forEach((item,index) => {
  2313. if(!map.has(item.id)){
  2314. map.set(item.id,index)
  2315. newArr.push(item)
  2316. }
  2317. })
  2318. return newArr
  2319. }
  2320. if (code === 0) {
  2321. const { spec:_spec = [] } = data;
  2322. const spec = unionSpec(_spec)
  2323. if (spec && spec.length > 0) {
  2324. if (this.spec_tableData && this.spec_tableData.length > 0) {
  2325. this.spec_tableData.forEach((c) => {
  2326. c.isMust = false;
  2327. });
  2328. spec.forEach((a, ai) => {
  2329. let findex = this.spec_tableData.findIndex(
  2330. (b) => b.spec_id + "" === a.id + ""
  2331. );
  2332. if (findex !== -1) {
  2333. this.spec_tableData[findex].isMust = true;
  2334. } else {
  2335. this.spec_tableData.push({
  2336. id: "",
  2337. index: "1",
  2338. spec_id: a.id + "",
  2339. spec_value: a.spec_name,
  2340. isMust: true,
  2341. spec_value_value: "",
  2342. spec_value_id: "",
  2343. });
  2344. }
  2345. });
  2346. } else {
  2347. spec.forEach((a, ai) => {
  2348. let model = {
  2349. id: "",
  2350. index: "1",
  2351. spec_id: a.id + "",
  2352. spec_value: a.spec_name,
  2353. isMust: true,
  2354. spec_value_value: "",
  2355. spec_value_id: "",
  2356. };
  2357. this.spec_tableData.push(model);
  2358. });
  2359. }
  2360. }
  2361. this.spec_tableData.map((e, ei) => {
  2362. e.index = ei + "";
  2363. return e;
  2364. });
  2365. this.spec_tableData.forEach((si, sii) => {
  2366. this.$set(this.spec_tableData, sii, si);
  2367. });
  2368. this.ruleForm.after_sales = data.cat_desc || "";
  2369. this.$refs.ruleForm.validateField("after_sales");
  2370. } else if (code >= 100 && code <= 104) {
  2371. await this.logout();
  2372. } else {
  2373. this.$message.warning(message);
  2374. }
  2375. } else {
  2376. this.spec_tableData.forEach((si, sii) => {
  2377. si.isMust = false;
  2378. this.$set(this.spec_tableData, sii, si);
  2379. });
  2380. }
  2381. },
  2382. async is_goold_price_change(e) {
  2383. await this.get_all_fee();
  2384. },
  2385. //商品品牌选择
  2386. brandidsearchChange(e) {
  2387. const { id, code, label } = e;
  2388. this.ruleForm.brandid = id ? [id] : [];
  2389. this.$refs.ruleForm.validateField("brandid");
  2390. },
  2391. //供应商选择
  2392. supplierNosearchChange(e) {
  2393. const { id, code, label } = e;
  2394. this.ruleForm.supplierNo = code ? [code] : [];
  2395. this.$refs.ruleForm.validateField("supplierNo");
  2396. },
  2397. //业务企业选择
  2398. company_idsearchChange(e) {
  2399. const { code } = e;
  2400. this.ruleForm.company_id = code || "";
  2401. this.$refs.ruleForm.validateField("company_id");
  2402. },
  2403. //税点选择
  2404. taxsearchChange(e) {
  2405. this.ruleForm.tax = e;
  2406. this.$refs.ruleForm.validateField("tax");
  2407. },
  2408. //专属类型选择
  2409. exclusiveSearchChange(e) {
  2410. this.ruleForm.is_exclusive = e;
  2411. this.$refs.ruleForm.validateField("is_exclusive");
  2412. },
  2413. //单位选择
  2414. unitsearchChange(e) {
  2415. const { id, code, label } = e;
  2416. this.ruleForm.unit = code ? [code] : [];
  2417. this.$refs.ruleForm.validateField("unit");
  2418. },
  2419. //贵金属种类选择
  2420. async noble_metalsearchChange(e) {
  2421. const { id, code, label } = e;
  2422. this.ruleForm.noble_metal = id || "";
  2423. this.$refs.ruleForm.validateField("noble_metal");
  2424. await this.get_all_fee();
  2425. },
  2426. //省市区
  2427. selectAreaChange(e, key) {
  2428. this.ruleForm[key] = e;
  2429. this.$refs.ruleForm.validateField(key);
  2430. },
  2431. closeImg(index, key) {
  2432. this.ruleForm[key].splice(index, 1);
  2433. this.$refs.ruleForm.validateField(key);
  2434. },
  2435. //图片上传成功
  2436. async UploadSuccessEvent(data, key) {
  2437. const { url } = data;
  2438. if (url === "noToken") {
  2439. await this.logout();
  2440. } else {
  2441. if (key === "good_thumb_img") {
  2442. this.ruleForm[key] = url;
  2443. } else {
  2444. if (this.ruleForm[key].length < 10) {
  2445. this.ruleForm[key].push(url);
  2446. }
  2447. }
  2448. this.$refs.ruleForm.validateField(key);
  2449. this.$message.success("图片上传成功!");
  2450. }
  2451. },
  2452. good_type_change() {
  2453. let list = ["moq", "customized"];
  2454. for (let i = 0; i < list.length; i++) {
  2455. this.rulesThis[list[i]][0].required = this.ruleForm.good_type === "1";
  2456. // console.log(list[i] + "===" + this.rulesThis[list[i]][0].required);
  2457. this.$refs.ruleForm.validateField(list[i]);
  2458. }
  2459. },
  2460. UploadErrorEvent(res, key) {
  2461. if (res !== "break") {
  2462. this.$message.error("图片上传失败!");
  2463. this.$refs.ruleForm.validateField(key);
  2464. }
  2465. },
  2466. //判断图片规格
  2467. beforeAvatarUpload(file) {
  2468. let isJPG = false;
  2469. if (
  2470. file.type === "image/jpg" ||
  2471. file.type === "image/png" ||
  2472. file.type === "image/jpeg"
  2473. ) {
  2474. isJPG = true;
  2475. }
  2476. const isLt2M = file.size / 1024 / 1024 < 1;
  2477. if (!isJPG) {
  2478. this.$message.error("图片格式不正确!");
  2479. }
  2480. if (!isLt2M) {
  2481. this.$message.error("图片大小不能超过 1MB!");
  2482. }
  2483. return isJPG && isLt2M;
  2484. },
  2485. },
  2486. };
  2487. </script>
  2488. <style lang="scss" scoped>
  2489. .goodsCostDetail {
  2490. // position: relative;
  2491. .good_info_img_div {
  2492. ul {
  2493. width: 100%;
  2494. li {
  2495. float: left;
  2496. width: 55px;
  2497. height: 55px;
  2498. padding: 0 5px 0 0;
  2499. .img-show-li-div {
  2500. width: 50px;
  2501. height: 50px;
  2502. border: 1px solid #dfe4ed;
  2503. background: #dfe4ed;
  2504. position: relative;
  2505. img.img-show {
  2506. width: 100%;
  2507. height: 100%;
  2508. position: relative;
  2509. display: inline-block;
  2510. }
  2511. i.el-icon-close {
  2512. position: absolute;
  2513. z-index: 2;
  2514. top: 0;
  2515. right: 0;
  2516. color: #dfe4ed;
  2517. }
  2518. &:hover {
  2519. i.el-icon-close {
  2520. cursor: pointer;
  2521. color: #6954f0;
  2522. }
  2523. }
  2524. }
  2525. }
  2526. }
  2527. }
  2528. .goodsCostAdd-title {
  2529. border-top: 1px solid #ebeef5;
  2530. span {
  2531. height: 50px;
  2532. line-height: 50px;
  2533. font-family: "微软雅黑", sans-serif;
  2534. font-weight: 400;
  2535. font-style: normal;
  2536. font-size: 16fpx;
  2537. text-align: left;
  2538. }
  2539. }
  2540. }
  2541. </style>