shopPublish.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322
  1. <template>
  2. <div class="components-container main-cont">
  3. <div style="display: inline-block;font-size:18px;margin-bottom: 15px;">
  4. <a href="#" @click="prev" style="text-decoration:none;font-size: 14px;">
  5. <icon-svg name="jiantou" style="width: 1.2em;height: 1.2em;position: relative;top: 0.3em;"></icon-svg>
  6. 返回
  7. </a>
  8. <span style="display: inline-block;margin: 0 15px;color: #D9D9D9;">|</span>
  9. <span>商品发布</span>
  10. </div>
  11. <div v-loading="tableDataLoading">
  12. <div style="position: relative;">
  13. <el-row>
  14. <el-col :span="8">
  15. <span>商品名称:</span>
  16. <el-input style="width: 200px;" class="margin15" placeholder="请输入商品标题" v-model="goodsName"
  17. autosize>
  18. </el-input>
  19. </el-col>
  20. <el-col :span="8">
  21. <span>商品分类:</span>
  22. <el-select v-model="classifyId" class="margin15" placeholder="请选择商品类型" style="width:200px;"
  23. @change="handleChange1">
  24. <el-option v-for="(item,index) in typeDatas" :key="index" :label="item.classifyName"
  25. :value="item.classifyId">
  26. </el-option>
  27. </el-select>
  28. </el-col>
  29. <!-- <el-col :span="6" >
  30. <span>商户号 :&nbsp;&nbsp;</span>
  31. <el-input style="width:200px;" class="margin15" placeholder="请输入商户号" v-model="merchants" autosize></el-input>
  32. </el-col> -->
  33. <el-col :span="8">
  34. <span>商品原价:</span>
  35. <el-input style="width:200px;" class="margin15" placeholder="请输入商品原价" type="number" :min="0"
  36. :controls="false" v-model="originalMoney" autosize></el-input>
  37. </el-col>
  38. <el-col :span="8">
  39. <span>折扣价格:</span>
  40. <el-input style="width:200px;" class="margin15" placeholder="请输入折扣价格" type="number" :min="0"
  41. :controls="false" v-model="goodsMoney" autosize></el-input>
  42. </el-col>
  43. <el-col :span="8">
  44. <span>打包费:</span>
  45. <el-input style="width:200px;" class="margin15" placeholder="请输入打包费" type="number" :min="0"
  46. :controls="false" v-model="packMoney" autosize></el-input>
  47. </el-col>
  48. <el-col :span="8">
  49. <span>商品销量:</span>
  50. <el-input style="width:200px;" class="margin15" placeholder="请输入商品销量" type="number" :min="0"
  51. :controls="false" v-model="sales" autosize></el-input>
  52. </el-col>
  53. <!-- <el-col :span="8">
  54. <span>库存:</span>
  55. <el-input style="width:200px;" class="margin15" placeholder="请输入库存" type="number" :min="0" :controls="false"
  56. v-model="inventory" autosize></el-input>
  57. </el-col> -->
  58. <!-- <el-col :span="8">
  59. <span>商品状态:</span>
  60. <el-select v-model="status" class="margin15" placeholder="请选择商品状态" style="width:200px;">
  61. <el-option v-for="(item,index) in statusmain2" :key="item.index" :label="item.label"
  62. :value="item.value">
  63. </el-option>
  64. </el-select>
  65. </el-col> -->
  66. <el-col :span="8">
  67. <span>商品简介:</span>
  68. <el-input style="width:200px;" class="margin15" placeholder="请输入商品简介" type="text"
  69. :controls="false" v-model="goodsDescribe" autosize></el-input>
  70. </el-col>
  71. </el-row>
  72. <el-row>
  73. <!-- <el-col :span="6">
  74. <span>会员价格:</span>
  75. <el-input style="width:200px;" class="margin15" placeholder="请输入会员价格" type="number" :min="0" :controls="false"
  76. v-model="memberPrice" autosize></el-input>
  77. </el-col>
  78. <el-col :span="6">
  79. <span>商品佣金:</span>
  80. <el-input style="width:200px;" class="margin15" placeholder="例0.1 等于10%" type="number" :min="0"
  81. :controls="false" v-model="commissionPrice" autosize></el-input>
  82. </el-col> -->
  83. </el-row>
  84. <el-row>
  85. <!-- <el-col :span="6">
  86. <span>必买理由:</span>
  87. <el-input style="width:200px;" class="margin15" placeholder="请输入必买理由" v-model="buyReason" autosize></el-input>
  88. </el-col>
  89. <el-col :span="6" style="margin-top: 20px;">
  90. <span>精选好物:</span>
  91. <el-radio-group v-model="isSelect">
  92. <el-radio :label="1">是</el-radio>
  93. <el-radio :label="0">否</el-radio>
  94. </el-radio-group>
  95. </el-col>
  96. <el-col :span="6" style="margin-top: 20px;">
  97. <span>首页商品:</span>
  98. <el-radio-group v-model="homeGoods">
  99. <el-radio :label="1">是</el-radio>
  100. <el-radio :label="0">否</el-radio>
  101. </el-radio-group>
  102. </el-col>
  103. <el-col :span="6" style="margin-top: 20px;">
  104. <span>每日推荐:</span>
  105. <el-radio-group v-model="isRecommend">
  106. <el-radio :label="1">是</el-radio>
  107. <el-radio :label="0">否</el-radio>
  108. </el-radio-group>
  109. </el-col> -->
  110. </el-row>
  111. <el-row>
  112. <!-- <el-col :span="6">
  113. <span>是否发货:</span>
  114. <el-select v-model="isExpress" class="margin15" placeholder="请选择商品是否发货" style="width:200px;">
  115. <el-option v-for="(item,index) in isExpressmain" :key="item.index" :label="item.label" :value="item.value">
  116. </el-option>
  117. </el-select>
  118. </el-col>
  119. <el-col :span="6">
  120. <span>商品品牌:</span>
  121. <el-select v-model="brandId" class="margin15" placeholder="请选择商品品牌" style="width:200px;">
  122. <el-option v-for="(item,index) in brandIds" :key="item.index" :label="item.label" :value="item.value">
  123. </el-option>
  124. </el-select>
  125. </el-col> -->
  126. <el-col :span="24">
  127. <div style="margin-top: 10px;">
  128. <span>商品标签:</span>
  129. <span class="bqList" v-for="(item,index) in labels" :key="index">{{item}}
  130. <span class="delss">
  131. <i class="el-icon-delete" @click="dels1(index)"></i>
  132. </span>
  133. </span>
  134. <el-input v-model="bq" style="width:200px;" placeholder="请输入标签"
  135. onkeyup="this.value=this.value.replace(/[, ]/g,'')"></el-input>
  136. <!-- <button class="tj" @click="btnTj">添加标签</button> -->
  137. <el-button type="primary" class="tj" size="mini" icon="el-icon-edit" circle @click="btnTj">
  138. </el-button>
  139. </div>
  140. </el-col>
  141. </el-row>
  142. <div style="display: flex;align-items: center;margin: 2% 0;">
  143. <span style="display: inline-block;text-align: right;">商品封面图:</span>
  144. <div
  145. style=" width:148px;height:148px;background-color: #fbfdff; border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;">
  146. <el-upload class="avatar-uploader" v-model="goodsCover"
  147. action="https://www.daweilinli.com/sqx_fast/alioss/upload" :show-file-list="false"
  148. :on-success="handleAvatarSuccess1">
  149. <img v-if="goodsCover" :src="goodsCover" class="avatar"
  150. style="width: 148px;height: 148px;" />
  151. <i v-else class="el-icon-plus avatar-uploader-icon"
  152. style="font-size: 28px;color: #8c939d"></i>
  153. </el-upload>
  154. </div>
  155. </div>
  156. <div style="display: flex;align-items: center;margin: 2% 0;flex-flow: wrap;">
  157. <span style="display: inline-block;text-align: right;">商品轮播图:</span>
  158. <div>
  159. <el-upload action="https://www.daweilinli.com/sqx_fast/alioss/upload"
  160. list-type="picture-card" :on-success="handleUploadSuccess" :on-change="handleChange"
  161. :on-remove="handleRemove">
  162. <i class="el-icon-plus"></i>
  163. </el-upload>
  164. </div>
  165. </div>
  166. <div style="display: flex;align-items: center;margin: 2% 0;">
  167. <span style="display: inline-block;text-align: right;">商品规格:</span>
  168. <el-radio-group v-model="guige" @change="guigeChange">
  169. <el-radio :label="0">单规格</el-radio>
  170. <el-radio :label="1">多规格</el-radio>
  171. </el-radio-group>
  172. <div v-if="guigeshow" style="margin-left: 20px;">
  173. <el-select v-model="ruleId" placeholder="请选择商品规格" style="width:200px;"
  174. @change="selectTrigger(ruleId)">
  175. <el-option v-for="(item,index) in specifdata" :key="item.index" :label="item.ruleName"
  176. :value="item.id">
  177. </el-option>
  178. </el-select>
  179. </div>
  180. </div>
  181. <div v-if="ruleValue" style="margin-left: 70px;">
  182. <div class="ruleitem" v-for="(item,index) in ruleValue" :key="index">
  183. <div>{{item.value}} <span @click="deleterule(index)">
  184. <icon-svg name="schu" class="ruleicon"></icon-svg>
  185. </span></div>
  186. <div>
  187. <el-tag :key="tag" v-for="(tag,j) in item.detail.split(',')" closable
  188. :disable-transitions="false" @close="handleClose(tag,j,item)">
  189. {{tag}}
  190. </el-tag>
  191. <el-input class="input-new-tag" v-model="inputValues[index]" ref="saveTagInput" size="small"
  192. style="width:120px;" placeholder="请输入属性名"
  193. @keyup.enter.native="handleInputConfirm(index,item)">
  194. </el-input>
  195. <el-button class="button-new-tag" size="small" @click="handleInputConfirm(index,item)">添加
  196. </el-button>
  197. </div>
  198. </div>
  199. <div style="margin-top:20px;" v-if="ruleshow">
  200. <div v-if="isshow" class="btn_specif">
  201. <el-button type="primary" @click="btnToclick()">添加新规格</el-button>
  202. <el-button type="success" @click="create()">立即生成</el-button>
  203. </div>
  204. </div>
  205. <div style="margin-top:10px;">
  206. <div v-if="!isshow" style="margin-top: 20px;">
  207. <div style="display: inline-block;">
  208. <span style="width:80px;display: inline-block;text-align: right;">规格:</span>
  209. <el-input style="width:50%;" v-model="releobject.value" placeholder="例:颜色"></el-input>
  210. </div>
  211. <div style="display: inline-block;">
  212. <span style="width:80px;display: inline-block;text-align: right;">规格值:</span>
  213. <el-input style="width:50%;" v-model="releobject.detail" placeholder="例:黑色"></el-input>
  214. </div>
  215. <div style="display: inline-block;">
  216. <el-button type="primary" @click="speciTo()">确 定</el-button>
  217. <el-button @click="speciTotwo()">取 消</el-button>
  218. </div>
  219. </div>
  220. </div>
  221. </div>
  222. <div style="display: flex;margin-top: 20px;" v-if="propshow">
  223. <span>商品属性:</span>
  224. <div class="property_table">
  225. <table style="width: 100%;">
  226. <tr style="display:flex;">
  227. <th style="width:120px;text-align: left;" v-for="item in headerData" v-if="item!='图片'">
  228. {{item}}</th>
  229. </tr>
  230. </table>
  231. <el-table :data="valueData">
  232. <el-table-column v-if="detailJson.length == 1" prop="value0" width="120">
  233. </el-table-column>
  234. <el-table-column v-if="detailJson.length == 2" prop="value0" width="120">
  235. </el-table-column>
  236. <el-table-column v-if="detailJson.length == 2" prop="value1" width="120">
  237. </el-table-column>
  238. <el-table-column v-if="detailJson.length == 3" prop="value0" width="120">
  239. </el-table-column>
  240. <el-table-column v-if="detailJson.length == 3" prop="value1" width="120">
  241. </el-table-column>
  242. <el-table-column v-if="detailJson.length == 3" prop="value2" width="120">
  243. </el-table-column>
  244. <el-table-column v-if="detailJson.length == 4" prop="value0" width="120">
  245. </el-table-column>
  246. <el-table-column v-if="detailJson.length == 4" prop="value1" width="120">
  247. </el-table-column>
  248. <el-table-column v-if="detailJson.length == 4" prop="value2" width="120">
  249. </el-table-column>
  250. <el-table-column v-if="detailJson.length == 4" prop="value3" width="120">
  251. </el-table-column>
  252. <el-table-column v-if="detailJson.length == 5" prop="value0" width="120">
  253. </el-table-column>
  254. <el-table-column v-if="detailJson.length == 5" prop="value1" width="120">
  255. </el-table-column>
  256. <el-table-column v-if="detailJson.length == 5" prop="value2" width="120">
  257. </el-table-column>
  258. <el-table-column v-if="detailJson.length == 5" prop="value3" width="120">
  259. </el-table-column>
  260. <el-table-column v-if="detailJson.length == 5" prop="value4" width="120">
  261. </el-table-column>
  262. <!-- <el-table-column prop="skuImg" width="100">
  263. <template slot-scope="scope">
  264. <div class="imgWrap"
  265. style=" width:60px;height:60px;background-color: #fbfdff; border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 60px;">
  266. <el-upload style="width: 60px;height: 60px;" class="avatar-uploader" v-model="scope.row.skuImg"
  267. action="https://www.daweilinli.com/sqx_fast/alioss/upload" :show-file-list="false"
  268. :on-success="handleAvatarSuccess">
  269. <img v-if="scope.row.skuImg" :src="scope.row.skuImg" class="avatar"
  270. style="border-radius: 6px;width:60px;height: 60px;" @click="curRowIndex=scope.$index" />
  271. <i v-else class="el-icon-plus avatar-uploader-icon" @click="curRowIndex=scope.$index"></i>
  272. </el-upload>
  273. </div>
  274. </template>
  275. </el-table-column> -->
  276. <el-table-column prop="skuOriginalPrice" width="120">
  277. <template slot-scope="scope">
  278. <div>
  279. <el-input type="text" v-model="scope.row.skuOriginalPrice"
  280. style="width:80px;font-size:14px;">
  281. </el-input>
  282. </div>
  283. </template>
  284. </el-table-column>
  285. <el-table-column prop="skuPrice" width="120">
  286. <template slot-scope="scope">
  287. <div>
  288. <el-input type="text" v-model="scope.row.skuPrice"
  289. style="width:80px;font-size:14px;">
  290. </el-input>
  291. </div>
  292. </template>
  293. </el-table-column>
  294. <!-- <el-table-column prop="memberPrice" width="120">
  295. <template slot-scope="scope">
  296. <div>
  297. <el-input type="text" v-model="scope.row.memberPrice" style="width:80px;font-size:14px;">
  298. </el-input>
  299. </div>
  300. </template>
  301. </el-table-column> -->
  302. <!-- <el-table-column prop="stock" width="120">
  303. <template slot-scope="scope">
  304. <div>
  305. <el-input type="text" v-model="scope.row.stock" style="width:80px;font-size:14px;">
  306. </el-input>
  307. </div>
  308. </template>
  309. </el-table-column> -->
  310. <!-- <el-table-column prop="salesVolume" width="120">
  311. <template slot-scope="scope">
  312. <div>
  313. <el-input type="text" v-model="scope.row.salesVolume" style="width:80px;font-size:14px;">
  314. </el-input>
  315. </div>
  316. </template>
  317. </el-table-column> -->
  318. <el-table-column width="120">
  319. <template slot-scope="scope">
  320. <el-button size="mini" type="danger"
  321. @click="deleter(scope.$index)">删除
  322. </el-button>
  323. </template>
  324. </el-table-column>
  325. </el-table>
  326. </div>
  327. </div>
  328. <div style="display: flex;margin-top: 20px;padding-top: 30px;" v-if="propshow1">
  329. <span>商品属性:</span>
  330. <div class="property_table">
  331. <table style="width: 100%;">
  332. <tr style="display:flex;">
  333. <th style="width:150px;text-align: left;" v-for="item in headerData2" v-if="item!='图片'">
  334. {{item}}</th>
  335. </tr>
  336. </table>
  337. <el-table :data="valueData2">
  338. <!-- <el-table-column prop="skuImg" width="150">
  339. <template slot-scope="scope">
  340. <div class="imgWrap"
  341. style=" width:60px;height:60px;background-color: #fbfdff; border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 60px;">
  342. <el-upload style="width: 60px;height: 60px;" class="avatar-uploader" v-model="scope.row.skuImg"
  343. action="https://www.daweilinli.com/sqx_fast/alioss/upload" :show-file-list="false"
  344. :on-success="handleAvatarSuccess3">
  345. <img v-if="scope.row.skuImg" :src="scope.row.skuImg" class="avatar"
  346. style="border-radius: 6px;width:60px;height: 60px;" @click="curRowIndex=scope.$index" />
  347. <i v-else class="el-icon-plus avatar-uploader-icon" @click="curRowIndex=scope.$index"></i>
  348. </el-upload>
  349. </div>
  350. </template>
  351. </el-table-column> -->
  352. <el-table-column prop="skuOriginalPrice" width="150">
  353. <template slot-scope="scope">
  354. <div>
  355. <el-input type="text" v-model="scope.row.skuOriginalPrice"
  356. style="width:80px;font-size:14px;">
  357. </el-input>
  358. </div>
  359. </template>
  360. </el-table-column>
  361. <el-table-column prop="skuPrice" width="150">
  362. <template slot-scope="scope">
  363. <div>
  364. <el-input type="text" v-model="scope.row.skuPrice"
  365. style="width:80px;font-size:14px;">
  366. </el-input>
  367. </div>
  368. </template>
  369. </el-table-column>
  370. <!-- <el-table-column prop="memberPrice" width="150">
  371. <template slot-scope="scope">
  372. <div>
  373. <el-input type="text" v-model="scope.row.memberPrice" style="width:80px;font-size:14px;">
  374. </el-input>
  375. </div>
  376. </template>
  377. </el-table-column> -->
  378. <!-- <el-table-column prop="stock" width="150">
  379. <template slot-scope="scope">
  380. <div>
  381. <el-input type="text" v-model="scope.row.stock" style="width:80px;font-size:14px;">
  382. </el-input>
  383. </div>
  384. </template>
  385. </el-table-column> -->
  386. <!-- <el-table-column prop="salesVolume" width="150">
  387. <template slot-scope="scope">
  388. <div>
  389. <el-input type="text" v-model="scope.row.salesVolume" style="width:80px;font-size:14px;">
  390. </el-input>
  391. </div>
  392. </template>
  393. </el-table-column> -->
  394. </el-table>
  395. </div>
  396. </div>
  397. <!-- <div style="height: 38px;line-height: 38px;margin:20px 0;">
  398. <span>是否包邮:</span>
  399. <el-radio-group v-model="positage" @change="agreeChange">
  400. <el-radio :label="0">是</el-radio>
  401. <el-radio :label="1">否</el-radio>
  402. <el-input v-if="priceshow" style="width:200px;margin-left: 10px;" placeholder="请输入邮费" type="number"
  403. v-model="postagePrice" autosize></el-input>
  404. </el-radio-group>
  405. </div> -->
  406. </div>
  407. <div class="tinymce-content" style="display: flex;">
  408. <div style="width:90px;">商品详情:</div>
  409. <!-- <textarea id="tinymceId" :value="goodsDescribe" class="tinymce-textarea" /> -->
  410. <!-- <quill-editor ref="myTextEditor" v-model="goodsSynopsis" :options="quillOption"
  411. style="padding-bottom: 50px;height: 300px;width: 72%;display: inline-table;margin-bottom: 60px;">
  412. </quill-editor> -->
  413. <div v-for="(item,index) of goodsParticularsPicture">
  414. <div style="position: relative;margin: 5px;">
  415. <img :src="item" class="avatar" style="width:148px;height: 148px;" />
  416. <div @click="clearXq(index)" class="divhove">
  417. <i class="el-icon-delete" style="margin: 0;font-size: 18px;color: #fff;"></i>
  418. </div>
  419. </div>
  420. </div>
  421. <div class="imgs" style="width: 50%;">
  422. <el-upload action="https://www.daweilinli.com/sqx_fast/alioss/upload"
  423. list-type="picture-card" :show-file-list="false" :on-success="handleUploadSuccessXq"
  424. :on-progress="onprogress1">
  425. <el-progress v-if="percentage1>0 && percentage1<100" type="circle" :percentage="percentage1">
  426. </el-progress>
  427. <i v-else class="el-icon-plus"></i>
  428. </el-upload>
  429. <el-dialog :visible.sync="dialogVisible">
  430. <img width="100%" :src="dialogImageUrl" alt="">
  431. </el-dialog>
  432. </div>
  433. </div>
  434. <div style="text-align: center;margin-top:30px;">
  435. <el-button style='margin:0 20px 0 0;' size="mini" type="primary" icon="document" @click="prev">返回上一页
  436. </el-button>
  437. <el-button size="mini" type="primary" icon="document" @click="artiReleass">发布商品
  438. </el-button>
  439. </div>
  440. </div>
  441. </div>
  442. </template>
  443. <script>
  444. import {
  445. quillEditor
  446. } from 'vue-quill-editor'
  447. import 'quill/dist/quill.core.css'
  448. import 'quill/dist/quill.snow.css'
  449. import 'quill/dist/quill.bubble.css'
  450. import quillConfig from './quill-config.js'
  451. export default {
  452. components: {
  453. quillEditor
  454. },
  455. name: 'Tinymce',
  456. data() {
  457. return {
  458. specif: '',
  459. typeId: '',
  460. goodsName: '',
  461. classifyId: '',
  462. merchants: '',
  463. originalMoney: '',
  464. goodsMoney: '',
  465. packMoney: '',
  466. goodsSynopsis: '',
  467. memberPrice: '',
  468. inventory: '', //库存
  469. labels: [], //标签集合
  470. bq: '', //输入的标签名
  471. positage: 1,
  472. guige: 1,
  473. skuImg: '',
  474. ruleId: '',
  475. postagePrice: '',
  476. priceshow: true,
  477. isshow: true,
  478. commissionPrice: '',
  479. buyReason: '',
  480. ruleshow: false,
  481. propshow: false,
  482. guigeshow: true,
  483. propshow1: false,
  484. tableDataLoading: false,
  485. ruleValue: [],
  486. attr: [],
  487. attrs: [],
  488. headerData: [],
  489. valueData: [],
  490. detailJson: [],
  491. inputValues: {
  492. inputValue0: '',
  493. inputValue1: '',
  494. inputValue2: '',
  495. inputValue3: '',
  496. inputValue4: '',
  497. inputValue5: ''
  498. },
  499. sku: [],
  500. img: '',
  501. sales:'',
  502. salesVolume: '',
  503. status: 0,
  504. goodsPicture: '',
  505. typeDatas: [],
  506. value: [],
  507. isSelect: 1,
  508. homeGoods: 1,
  509. isRecommend: 1,
  510. isExpress: '',
  511. goodsCover: '',
  512. valueData2: [],
  513. headerData2: [],
  514. statusmain2: [{
  515. value: 0,
  516. label: '上架'
  517. },
  518. {
  519. value: 1,
  520. label: '下架'
  521. }
  522. ],
  523. isExpressmain: [{
  524. value: 1,
  525. label: '普通商品需要发货'
  526. },
  527. {
  528. value: 2,
  529. label: '虚拟商品无需发货'
  530. },
  531. {
  532. value: 3,
  533. label: '商铺核销无需发货'
  534. }
  535. ],
  536. attrName: '',
  537. ruleName: '',
  538. attrValue: [],
  539. releobject: {
  540. value: '',
  541. detail: ''
  542. },
  543. brandId: '',
  544. brandIds: [],
  545. specifdata: [],
  546. dialogVisible: false,
  547. isShow: false,
  548. hideUpload: false,
  549. limit: 1,
  550. id: '',
  551. hasChange: false,
  552. hasInit: false,
  553. tinymceId: 'tinymceId',
  554. height: 435,
  555. toolbar: [],
  556. menubar: 'file edit insert view format table',
  557. languageTypeList: {
  558. 'en': 'en',
  559. 'zh': 'zh_CN'
  560. },
  561. artiCletypes: [],
  562. // 富文本内容
  563. quillOption: quillConfig,
  564. goodsDescribe: '',
  565. potost: [],
  566. shopId: '',
  567. goodsParticularsPicture: [], //商品详情图
  568. percentage1: 0, //进度条
  569. dialogImageUrl: [],
  570. dialogVisible: false,
  571. }
  572. },
  573. methods: {
  574. // 图标上传
  575. handleAvatarSuccess(file) {
  576. if (this.curRowIndex == 0) {
  577. this.skuImg = file.data;
  578. this.valueData[0].skuImg = this.skuImg
  579. return
  580. } else {
  581. this.skuImg = file.data;
  582. this.valueData[this.curRowIndex].skuImg = this.skuImg
  583. }
  584. },
  585. // 图标上传
  586. handleAvatarSuccess3(file) {
  587. this.skuImg = file.data;
  588. this.valueData2[0].skuImg = this.skuImg
  589. },
  590. // 是否包邮
  591. agreeChange(val) {
  592. if (val == 1) {
  593. this.priceshow = true
  594. this.postagePrice = ''
  595. } else {
  596. this.priceshow = false
  597. this.postagePrice = 0
  598. }
  599. },
  600. // 是否多规格
  601. guigeChange(val) {
  602. if (val == 1) {
  603. this.ruleId = ''
  604. this.guigeshow = true
  605. this.propshow1 = false
  606. } else {
  607. this.ruleId = 0
  608. this.guigeshow = false
  609. this.propshow1 = true
  610. this.propshow = false
  611. this.ruleshow = false
  612. this.attr = []
  613. this.ruleValue = []
  614. this.guigeclect()
  615. }
  616. },
  617. // 单规格
  618. guigeclect() {
  619. if (this.originalMoney == '') {
  620. this.originalMoney = '0'
  621. }
  622. if (this.goodsMoney == '') {
  623. this.goodsMoney = '0'
  624. }
  625. this.$http({
  626. url: this.$http.adornUrl('admin/goods/onlyFormatAttr'),
  627. method: 'get',
  628. params: this.$http.adornParams({
  629. 'originalPrice': this.originalMoney,
  630. 'price': this.goodsMoney,
  631. // 'coverImg': this.goodsCover,
  632. })
  633. }).then(({
  634. data
  635. }) => {
  636. let returnData = data.data;
  637. this.headerData2 = returnData.header
  638. this.valueData2 = returnData.value
  639. this.propshow = false
  640. this.propshow1 = true
  641. this.sku = returnData.value
  642. })
  643. },
  644. handleChange1(value) {
  645. this.classifyId = value;
  646. },
  647. handleChange(file, fileList) {
  648. this.hideUpload = fileList.length >= this.limit;
  649. },
  650. handleRemove(file, fileList) {
  651. console.log(file, '删除', fileList)
  652. this.hideUpload = fileList.length >= this.limit;
  653. for (var i in this.potost) {
  654. if (this.potost[i] == file.response.data) {
  655. this.potost.splice(i, 1);
  656. }
  657. }
  658. console.log('this.potost', this.potost)
  659. },
  660. handleAvatarSuccess1(file, fileList) {
  661. this.goodsCover = file.data
  662. },
  663. //上传成功
  664. handleUploadSuccess(file, fileList) {
  665. // this.goodsPicture += file.data + ','
  666. this.potost.push(file.data)
  667. },
  668. // 返回上一级
  669. prev() {
  670. this.$router.back()
  671. },
  672. // 添加标签
  673. btnTj() {
  674. if (this.bq == '' || this.bq == ' ') {
  675. this.$notify({
  676. title: '提示',
  677. duration: 1800,
  678. message: '请输入标签名',
  679. type: 'warning'
  680. });
  681. return
  682. } else {
  683. console.log('this.bq', this.bq)
  684. this.labels.push(this.bq)
  685. this.bq = ''
  686. }
  687. },
  688. // 删除标签
  689. dels1(index) {
  690. this.labels.splice(index, 1);
  691. console.log(this.labels)
  692. },
  693. // 发布商品
  694. artiReleass() {
  695. let photost = this.potost.toString()
  696. console.log(this.goodsDescribe)
  697. console.log(this.potost.toString())
  698. // photost = photost.substr(0, photost.length - 1)
  699. let goodsLabel = this.labels.toString()
  700. if (this.goodsName == '') {
  701. this.$notify({
  702. title: '提示',
  703. duration: 1800,
  704. message: '请输入商品标题',
  705. type: 'warning'
  706. });
  707. return
  708. }
  709. if (this.classifyId == '') {
  710. this.$notify({
  711. title: '提示',
  712. duration: 1800,
  713. message: '请选择商品类型',
  714. type: 'warning'
  715. });
  716. return
  717. }
  718. if (this.originalMoney == '') {
  719. this.$notify({
  720. title: '提示',
  721. duration: 1800,
  722. message: '请输入商品原价',
  723. type: 'warning'
  724. });
  725. return
  726. }
  727. // if (this.originalMoney < 1) {
  728. // this.$notify({
  729. // title: '提示',
  730. // duration: 1800,
  731. // message: '商品原价不能小于1元',
  732. // type: 'warning'
  733. // });
  734. // return
  735. // }
  736. // if (this.goodsMoney == '') {
  737. // this.$notify({
  738. // title: '提示',
  739. // duration: 1800,
  740. // message: '请输入折扣价格',
  741. // type: 'warning'
  742. // });
  743. // return
  744. // }
  745. if (this.packMoney == '') {
  746. this.$notify({
  747. title: '提示',
  748. duration: 1800,
  749. message: '请输入打包费',
  750. type: 'warning'
  751. });
  752. return
  753. }
  754. if (this.goodsDescribe == '') {
  755. this.$notify({
  756. title: '提示',
  757. duration: 1800,
  758. message: '请输入简介',
  759. type: 'warning'
  760. });
  761. return
  762. }
  763. // if (this.salesVolume == '') {
  764. // this.$notify({
  765. // title: '提示',
  766. // duration: 1800,
  767. // message: '请输入商品销量',
  768. // type: 'warning'
  769. // });
  770. // return
  771. // }
  772. if (this.goodsCover == '') {
  773. this.$notify({
  774. title: '提示',
  775. duration: 1800,
  776. message: '请选择商品封面图',
  777. type: 'warning'
  778. });
  779. return
  780. }
  781. if (this.goodsDescribe == '') {
  782. this.$notify({
  783. title: '提示',
  784. duration: 1800,
  785. message: '请输入商品详情',
  786. type: 'warning'
  787. });
  788. return
  789. }
  790. // if (this.inventory == '') {
  791. // this.$notify({
  792. // title: '提示',
  793. // duration: 1800,
  794. // message: '请输入库存',
  795. // type: 'warning'
  796. // });
  797. // return
  798. // }
  799. if (this.sku.length == 0) {
  800. this.$notify({
  801. title: '提示',
  802. duration: 1800,
  803. message: '请选择商品规格',
  804. type: 'warning'
  805. });
  806. return
  807. }
  808. if (photost == '') {
  809. this.$notify({
  810. title: '提示',
  811. duration: 1800,
  812. message: '请上传轮播图',
  813. type: 'warning'
  814. });
  815. return
  816. }
  817. if (this.goodsParticularsPicture.length == 0) {
  818. this.$notify({
  819. title: '提示',
  820. duration: 1800,
  821. message: '请上传商品详情图',
  822. type: 'warning'
  823. });
  824. return
  825. }
  826. if (this.guige == 0) {
  827. if (this.valueData2.length > 0) {
  828. if (this.valueData2[0].skuOriginalPrice == null || this.valueData2[0].skuOriginalPrice === '') {
  829. this.$notify({
  830. title: '提示',
  831. duration: 1800,
  832. message: '商品属性原价不能为空',
  833. type: 'warning'
  834. });
  835. return
  836. }
  837. if (this.valueData2[0].skuPrice == null || this.valueData2[0].skuPrice === '') {
  838. this.$notify({
  839. title: '提示',
  840. duration: 1800,
  841. message: '商品属性售价不能为空',
  842. type: 'warning'
  843. });
  844. return
  845. }
  846. }
  847. this.sku = this.valueData2
  848. console.log('----', this.valueData2)
  849. } else {
  850. this.sku = this.valueData
  851. }
  852. this.tableDataLoading = true
  853. this.$http({
  854. url: this.$http.adornUrl('admin/goods/insertGoods'),
  855. method: 'post',
  856. data: this.$http.adornData({
  857. 'goodsPicture': photost,
  858. 'goodsName': this.goodsName,
  859. 'classifyId': this.classifyId,
  860. 'originalMoney': this.originalMoney,
  861. 'goodsMoney': this.goodsMoney,
  862. 'packMoney': this.packMoney,
  863. 'goodsSynopsis': this.goodsSynopsis,
  864. 'memberPrice': this.memberPrice,
  865. 'inventory': this.inventory,
  866. 'salesVolume': this.salesVolume,
  867. 'sales':this.sales,
  868. 'status': this.status,
  869. 'goodsCover': this.goodsCover,
  870. 'goodsDescribe': this.goodsDescribe,
  871. 'postagePrice': this.postagePrice,
  872. 'sku': this.sku,
  873. 'attr': this.attr,
  874. 'goodsLabel': goodsLabel,
  875. 'shopId': this.shopId,
  876. 'goodsParticularsPicture': this.goodsParticularsPicture.toString()
  877. })
  878. }).then(({
  879. data
  880. }) => {
  881. if (data.code == 0) {
  882. this.tableDataLoading = false
  883. this.$message({
  884. message: '操作成功',
  885. type: 'success',
  886. duration: 1500,
  887. onClose: () => {
  888. this.goodsName = ''
  889. this.type = ''
  890. this.merchants = ''
  891. this.goodsMoney = ''
  892. this.packMoney = ''
  893. this.goodsSynopsis = ''
  894. this.memberPrice = ''
  895. this.inventory = ''
  896. this.originalMoney = ''
  897. this.salesVolume = ''
  898. this.sales = ''
  899. this.goodsDescribe = ''
  900. this.postagePrice = ''
  901. this.status = ''
  902. this.buyReason = ''
  903. this.brandId = ''
  904. // this.$router.push({
  905. // path: '/shopAdmin'
  906. // })
  907. this.$router.back()
  908. }
  909. })
  910. } else {
  911. this.tableDataLoading = false
  912. this.$message({
  913. message: data.msg,
  914. type: 'warning',
  915. duration: 1500,
  916. onClose: () => {}
  917. })
  918. }
  919. })
  920. },
  921. // 商品分类
  922. dataSelect() {
  923. this.tableDataLoading = true
  924. this.shopId = this.$cookie.get('shopId')
  925. this.$http({
  926. url: this.$http.adornUrl('admin/goods/selectAllClassify'),
  927. method: 'get',
  928. params: this.$http.adornParams({
  929. 'shopId': this.shopId
  930. })
  931. }).then(({
  932. data
  933. }) => {
  934. this.tableDataLoading = false
  935. let returnData = data.data;
  936. this.typeDatas = returnData
  937. })
  938. },
  939. // 商品规格
  940. specifSelect() {
  941. this.shopId = this.$cookie.get('shopId')
  942. this.$http({
  943. url: this.$http.adornUrl('selfGoodsRule/list'),
  944. method: 'get',
  945. params: this.$http.adornParams({
  946. 'shopId': this.shopId
  947. })
  948. }).then(({
  949. data
  950. }) => {
  951. let returnData = data.data;
  952. this.specifdata = returnData;
  953. })
  954. },
  955. // 删除商品属性
  956. deleter(index) {
  957. let length = this.sku.length
  958. if (length == 1) {
  959. this.$message({
  960. title: '提示',
  961. type: 'error',
  962. duration: 1800,
  963. message: '属性至少要有一个',
  964. type: 'warning'
  965. });
  966. return
  967. } else {
  968. this.sku.splice(index, 1);
  969. }
  970. },
  971. // 查询商品规格
  972. selectTrigger(val) {
  973. this.$http({
  974. url: this.$http.adornUrl('selfGoodsRule/find'),
  975. method: 'get',
  976. params: this.$http.adornParams({
  977. 'id': val
  978. })
  979. }).then(({
  980. data
  981. }) => {
  982. let returnData = data.data;
  983. this.ruleValue = returnData.ruleValue
  984. this.attrName = returnData.ruleName
  985. this.ruleshow = true
  986. this.ruleId = returnData.id
  987. this.create()
  988. })
  989. },
  990. deleterule(index) {
  991. this.ruleValue.splice(index, 1);
  992. },
  993. btnToclick() {
  994. this.isshow = false
  995. this.releobject.value = ''
  996. this.releobject.detail = ''
  997. },
  998. speciTotwo() {
  999. this.isshow = true
  1000. this.releobject.value = ''
  1001. this.releobject.detail = ''
  1002. },
  1003. speciTo() {
  1004. if (this.releobject.value == '') {
  1005. this.$message({
  1006. title: '提示',
  1007. type: 'error',
  1008. duration: 1800,
  1009. message: '请输入规格',
  1010. type: 'warning'
  1011. });
  1012. return
  1013. }
  1014. if (this.releobject.detail == '') {
  1015. this.$message({
  1016. title: '提示',
  1017. duration: 1800,
  1018. type: 'error',
  1019. message: '请输入规格值',
  1020. type: 'warning'
  1021. });
  1022. return
  1023. }
  1024. this.ruleValue.push({
  1025. value: this.releobject.value,
  1026. detail: this.releobject.detail
  1027. });
  1028. this.isshow = true
  1029. this.releobject.value = ''
  1030. this.releobject.detail = ''
  1031. },
  1032. handleClose(tag, j, item) {
  1033. var detailarr = item.detail.split(',')
  1034. detailarr.splice(j, 1);
  1035. if (detailarr.length < 1) {
  1036. this.$message({
  1037. title: '提示',
  1038. type: 'error',
  1039. duration: 1800,
  1040. message: '规格值至少要有一个',
  1041. type: 'warning'
  1042. });
  1043. return
  1044. } else {
  1045. item.detail = String(detailarr)
  1046. }
  1047. },
  1048. handleInputConfirm(index, item) {
  1049. let inputValue = this.inputValues[index];
  1050. if (inputValue) {
  1051. var detailarr = item.detail.split(',')
  1052. detailarr.push(inputValue)
  1053. for (var i = 0; i < detailarr.length; i++) {
  1054. for (var j = 0; j < detailarr.length; j++) {
  1055. if (detailarr[i] == detailarr[j] && i != j) {
  1056. detailarr.splice(j, 1);
  1057. }
  1058. }
  1059. }
  1060. item.detail = String(detailarr)
  1061. this.inputValues[index] = '';
  1062. }
  1063. this.inputVisible = false;
  1064. },
  1065. // 获取品牌
  1066. // brandSelect() {
  1067. // let page = this.page - 1
  1068. // this.tableDataLoading = true
  1069. // this.$http({
  1070. // url: this.$http.adornUrl('selfGoodsBrand/result'),
  1071. // method: 'get',
  1072. // params: this.$http.adornParams({})
  1073. // }).then(({
  1074. // data
  1075. // }) => {
  1076. // this.tableDataLoading = false
  1077. // let returnData = data.data;
  1078. // this.brandIds = returnData
  1079. // })
  1080. // },
  1081. // 立即生成
  1082. create() {
  1083. this.attr = []
  1084. this.attr.push({
  1085. attrName: this.attrName,
  1086. attrValue: this.ruleValue,
  1087. ruleId: this.ruleId
  1088. })
  1089. if (this.originalMoney == '') {
  1090. this.originalMoney = '0'
  1091. }
  1092. if (this.goodsMoney == '') {
  1093. this.goodsMoney = '0'
  1094. }
  1095. if (this.memberPrice == '') {
  1096. this.memberPrice = '0'
  1097. }
  1098. this.$http({
  1099. url: this.$http.adornUrl(
  1100. // `admin/goods/isFormatAttr?coverImg=${this.goodsCover}&originalPrice=${this.originalMoney}&price=${this.goodsMoney}`
  1101. `admin/goods/isFormatAttr?originalPrice=${this.originalMoney}&price=${this.goodsMoney}`
  1102. ),
  1103. method: 'post',
  1104. data: this.attr[0]
  1105. }).then(({
  1106. data
  1107. }) => {
  1108. let returnData = data.data;
  1109. this.headerData = returnData.header
  1110. this.valueData = returnData.value
  1111. this.propshow = true
  1112. this.propshow1 = false
  1113. this.sku = returnData.value
  1114. this.detailJson = returnData.value[0].detailJson.split(',')
  1115. })
  1116. },
  1117. // 删除详情图
  1118. clearXq(index) {
  1119. this.goodsParticularsPicture.splice(index, 1);
  1120. },
  1121. //上传成功
  1122. handleUploadSuccessXq(file, fileList) {
  1123. this.goodsParticularsPicture.push(file.data)
  1124. },
  1125. onprogress1(event, file, fileList) {
  1126. console.log('详情图上传进度', parseInt(event.percent))
  1127. this.percentage1 = parseInt(event.percent)
  1128. },
  1129. },
  1130. mounted() {
  1131. this.shopId = this.$route.query.shopId
  1132. console.log('shopId:', this.shopId)
  1133. // this.init()
  1134. this.dataSelect()
  1135. this.specifSelect()
  1136. this.goodsName = ''
  1137. this.type = ''
  1138. this.merchants = ''
  1139. this.goodsMoney = ''
  1140. this.packMoney = ''
  1141. this.goodsSynopsis = ''
  1142. this.memberPrice = ''
  1143. this.inventory = ''
  1144. this.originalMoney = ''
  1145. this.salesVolume = ''
  1146. this.sales = ''
  1147. this.goodsDescribe = ''
  1148. this.postagePrice = ''
  1149. this.status = ''
  1150. this.buyReason = ''
  1151. this.brandId = ''
  1152. // this.brandSelect()
  1153. },
  1154. }
  1155. </script>
  1156. <style scoped="scoped">
  1157. .main-cont {
  1158. max-width: 100%;
  1159. min-width: 80%;
  1160. padding-bottom: 5%;
  1161. background-color: #fff;
  1162. }
  1163. .tinymce-container {
  1164. position: relative;
  1165. line-height: normal;
  1166. }
  1167. .tinymce-container>>>.mce-fullscreen {
  1168. z-index: 10000;
  1169. }
  1170. .tinymce-textarea {
  1171. visibility: hidden;
  1172. z-index: -1;
  1173. }
  1174. .hide .el-upload--picture-card {
  1175. display: none;
  1176. }
  1177. .margin15 {
  1178. margin-right: 15px;
  1179. margin-top: 10px;
  1180. }
  1181. .ruleitem {
  1182. padding-left: 10px;
  1183. margin-top: 15px;
  1184. }
  1185. .ruleitem .ruleicon {
  1186. position: relative;
  1187. top: 3px;
  1188. left: 2px;
  1189. width: 1.2em;
  1190. height: 1.2em;
  1191. }
  1192. .el-tag+.el-tag {
  1193. margin-left: 10px;
  1194. }
  1195. .button-new-tag {
  1196. height: 32px;
  1197. line-height: 31px;
  1198. padding-top: 0;
  1199. padding-bottom: 0;
  1200. border-radius: 4px;
  1201. border-top-left-radius: 0;
  1202. border-bottom-left-radius: 0;
  1203. background-color: #f5f7fa;
  1204. position: relative;
  1205. left: -5px;
  1206. border-color: #dcdfe6;
  1207. border: 1px solid #dcdfe6;
  1208. }
  1209. .input-new-tag {
  1210. width: 90px;
  1211. margin-left: 10px;
  1212. vertical-align: bottom;
  1213. }
  1214. .el-input--small .el-input__inner {
  1215. border-top-right-radius: 0;
  1216. border-bottom-right-radius: 0;
  1217. }
  1218. .el-table--enable-row-transition .el-table__body td {
  1219. text-align: center;
  1220. }
  1221. .imgWrap .avatar-uploader .el-upload {
  1222. width: 60px;
  1223. }
  1224. .el-table .cell {
  1225. text-align: center !important;
  1226. }
  1227. .el-tag--medium {
  1228. margin-right: 10px;
  1229. }
  1230. .bqList {
  1231. padding: 4px 14px;
  1232. margin: 4px;
  1233. border: 1px solid #efefef;
  1234. font-size: 12px;
  1235. color: #999;
  1236. border-radius: 4px;
  1237. margin-right: 15px;
  1238. }
  1239. .delss {
  1240. display: none;
  1241. position: relative;
  1242. }
  1243. .delss .el-icon-delete {
  1244. position: absolute;
  1245. top: 0;
  1246. }
  1247. .bqList:hover .delss {
  1248. display: initial;
  1249. opacity: 0.5;
  1250. }
  1251. .tj {
  1252. padding: 6px !important;
  1253. margin: 4px;
  1254. font-size: 12px;
  1255. border: 1px solid #ccc;
  1256. border-radius: 4px;
  1257. }
  1258. .divhove {
  1259. position: absolute;
  1260. width: 100%;
  1261. height: 100%;
  1262. left: 0;
  1263. top: 0;
  1264. opacity: 0;
  1265. cursor: default;
  1266. text-align: center;
  1267. padding-top: 50%;
  1268. border-radius: 6px;
  1269. background-color: rgba(0, 0, 0, .5);
  1270. -webkit-transition: opacity .3s;
  1271. transition: opacity .3s;
  1272. }
  1273. .el-tag--medium {
  1274. margin-right: 10px;
  1275. }
  1276. .divhove:hover {
  1277. opacity: 0.8;
  1278. }
  1279. </style>