style.php 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  1. <template id="store-commodity-classify-group-style">
  2. <div class="store-commodity-classify-group-style">
  3. <diy-tabs class="fill-border-top" :default_item="defaultForm.tabItem" title="样式" radio_text='text' :default_color="defaultForm.default_color" @change="colorSelect"></diy-tabs>
  4. <!-- 公共 -->
  5. <!-- <diy-style-contain title="风格" class="clear-diy-style fill-border-top">-->
  6. <!-- <el-radio-group v-model="style" @change="onStyleList">-->
  7. <!-- <el-radio-button :label="item.label" v-for="(item,index) in styleList" :key="index">-->
  8. <!-- <div flex="cross:center" class="flex-x-center" style="width: 56px;height: 38px;">-->
  9. <!-- <img :src="item.src" style="width: 26px;">-->
  10. <!-- </div>-->
  11. <!-- </el-radio-button>-->
  12. <!-- </el-radio-group>-->
  13. <!-- </diy-style-contain>-->
  14. <diy-style-contain title="选择商品" class="clear-diy-style fill-border-top">
  15. <div style="margin-bottom: 10px;">
  16. <el-radio-group v-model="chooseGoods" @change="updateData($event,'chooseGoods')">
  17. <el-radio :label="1">手动选择</el-radio>
  18. <el-radio :label="2">选择分类</el-radio>
  19. <!-- <el-radio :label="3">选择分组</el-radio> -->
  20. </el-radio-group>
  21. </div>
  22. <div class="pick-goods" v-if="chooseGoods == 1">
  23. <com-pick-link @selected="selectNavUrl" :default-select-list="defaultSelectList" :pick-type="pickType" :isCustomWidth="true" :default-tabs="[{name: 'marketing',children:['store_goods'] }]">
  24. <div class="add-goods-btn">+添加</div>
  25. </com-pick-link>
  26. <div flex="cross:center" style="margin-top: 20px;" v-if="pickImgList.length">
  27. <draggable v-model="pickImgList" v-if="pickImgList.length" flex="dif:left" style="display:flex;flex-wrap:wrap" @end="changeGoodsList">
  28. <div class="pickImgItem" v-for="(item,index) in pickImgList" :key="index" @mouseenter="mouseenter(index)" @mouseleave="mouseleave(index)">
  29. <el-image style="width: 50px; height: 50px" :src="item.params.img" fit="contain"></el-image>
  30. <div v-show="index == pickIndex || item.visible">
  31. <el-popover placement="bottom" v-model="item.visible">
  32. <p class="diy-del-text">确定删除吗?</p>
  33. <div flex="cross:center">
  34. <el-button class="diy-del-btn" size="mini" plain @click="delModel(index)">删除</el-button>
  35. <el-button size="mini" plain @click="item.visible = false">取消</el-button>
  36. </div>
  37. <i class="el-icon-close" slot="reference" style="color:#999;"></i>
  38. </el-popover>
  39. </div>
  40. </div>
  41. </draggable>
  42. </div>
  43. </div>
  44. <div class="pick-goods" v-if="chooseGoods == 2" style="padding: 10px;">
  45. <div class="icon-set-items" flex="cross:center">
  46. <div class="icon-set-list-name diy-text-font">链接</div>
  47. <div class="icon-set-list-content" flex="cross:center">
  48. <com-pick-link @selected="selectedUrl($event)" :auto-width="true" :pick-type="pickType" :default-tabs="[{name: 'marketing',children:['store-commodity-cate'] }]">
  49. <diy-url text=""></diy-url>
  50. </com-pick-link>
  51. </div>
  52. </div>
  53. <div class="icon-set-items" :key="index" v-for="(item,index) in selectUrlList">
  54. <diy-url :text="item.title+''" ></diy-url>
  55. <div class="icon-set-items-close">
  56. <el-popover placement="bottom" v-model="item.visible">
  57. <p class="diy-del-text">确定删除吗?</p>
  58. <div flex="cross:center">
  59. <el-button class="diy-del-btn" size="mini" plain @click="delClassifyUrl(index)">删除</el-button>
  60. <el-button size="mini" plain @click="item.visible = false">取消</el-button>
  61. </div>
  62. <i class="el-icon-close" slot="reference" style="color:#999;"></i>
  63. </el-popover>
  64. </div>
  65. </div>
  66. <diy-operation-list v-if="selectUrlList.length" v-model="showLineList" @on-change="onChange5"> </diy-operation-list>
  67. </div>
  68. </diy-style-contain>
  69. <!-- <diy-style-contain title="显示内容 (划线价和会员价同时选择时,优先显示会员价)" class="show-content fill-border-top">-->
  70. <!-- <!-- <div class="tip">(划线价和会员价同时选择时,优先显示会员价)</div> -->
  71. <!-- <el-checkbox-group v-model="contentCheckList" @change="onContentChange">-->
  72. <!-- <div v-for="(item,index) in showContentList" :key="index">-->
  73. <!-- <div flex="cross:center" class="flex-y-center" style="margin-bottom: 12px;">-->
  74. <!-- <el-checkbox :label="item.label">-->
  75. <!-- <span>{{item.name}}</span>-->
  76. <!-- </el-checkbox>-->
  77. <!-- <el-color-picker v-if="!item.disableColor" class="show-content-pick" color-format="colorFormat" :show-alpha="item.showAlpha" v-model="item.color" @change="onPickColor"></el-color-picker>-->
  78. <!-- <el-input v-if="!item.disableColor" v-model="item.color" @input="updateInput($event,item)" class="diy-text-btn"></el-input>-->
  79. <!-- </div>-->
  80. <!-- </div>-->
  81. <!-- </el-checkbox-group>-->
  82. <!-- </diy-style-contain>-->
  83. <!-- <diy-style-contain title="购物车按钮" class="show-content fill-border-top">-->
  84. <!-- <el-radio-group v-model="shoppingCart" @change="updateData($event,'showShopCart')">-->
  85. <!-- <el-radio :label="1">显示</el-radio>-->
  86. <!-- <el-radio :label="2">隐藏</el-radio>-->
  87. <!-- </el-radio-group>-->
  88. <!-- <div class="shopping-cart-func" v-show="shoppingCart == 1">-->
  89. <!-- <div class="shop-cart-row" flex="cross:center">-->
  90. <!-- <div class="leabl">样式</div>-->
  91. <!-- <diy-tab v-model="shopCartStyleList" :default-index="shopCartStyle" @change="onShopCartStyle">-->
  92. <!-- <template v-slot="{item, isSelect}">-->
  93. <!-- <div flex="cross:center" :class="{'shop-cart-col': true,'selected': isSelect}">-->
  94. <!-- <img :src="item.src" style="width: 32px;">-->
  95. <!-- </div>-->
  96. <!-- </template>-->
  97. <!-- </diy-tab>-->
  98. <!-- </div>-->
  99. <!-- <div class="shop-cart-row" flex="cross:center" v-if="shopCartStyle == 0">-->
  100. <!-- <div class="leabl">文字</div>-->
  101. <!-- <el-input style="flex: 1;" v-model="shopCartText" placeholder="请输入内容" maxlength="4" size="small" show-word-limit @input="updateShopCartText($event,'showShopCart')"></el-input>-->
  102. <!-- </div>-->
  103. <!-- <div class="shop-cart-row" flex="cross:center" v-if="shopCartStyle != 3">-->
  104. <!-- <div class="leabl">颜色</div>-->
  105. <!-- <div flex="cross:center">-->
  106. <!-- <el-color-picker class="show-content-pick" color-format="colorFormat" v-model="shopCartColor" @change="onShopCart($event,'color')"></el-color-picker>-->
  107. <!-- <el-input v-model="shopCartColor" maxlength="8" @input="onShopCart($event,'color')" class="diy-text-btn"></el-input>-->
  108. <!-- </div>-->
  109. <!-- </div>-->
  110. <!-- <div class="shop-cart-row" flex="cross:center" v-if="shopCartStyle == 0">-->
  111. <!-- <div class="leabl">圆角</div>-->
  112. <!-- <div flex="cross:center">-->
  113. <!-- <el-slider style="width: 165px;" :min="0" :max="20" v-model="shopCartRadius" @change="onShopCart($event,'borderReduis')"></el-slider>-->
  114. <!-- <div style="margin-left: 16px;" class="diy-text-btn">{{shopCartRadius}}px</div>-->
  115. <!-- </div>-->
  116. <!-- </div>-->
  117. <!-- <div class="shop-cart-row" flex="cross:center" v-if="shopCartStyle != 3">-->
  118. <!-- <div class="leabl">背景</div>-->
  119. <!-- <div flex="cross:center">-->
  120. <!-- <el-color-picker class="show-content-pick" color-format="colorFormat" v-model="shopCartBgColor" @change="onShopCart($event,'backgroundColor')"></el-color-picker>-->
  121. <!-- <el-input v-model="shopCartBgColor" maxlength="8" @input="onShopCart($event,'backgroundColor')" class="diy-text-btn"></el-input>-->
  122. <!-- </div>-->
  123. <!-- </div>-->
  124. <!-- <div class="shop-cart-row" flex="cross:center" v-if="shopCartStyle <= 1">-->
  125. <!-- <div class="leabl">边框</div>-->
  126. <!-- <div flex="cross:center">-->
  127. <!-- <el-color-picker class="show-content-pick" color-format="colorFormat" v-model="shopCartBorderColor" @change="onShopCart($event,'borderColor')"></el-color-picker>-->
  128. <!-- <el-input v-model="shopCartBorderColor" maxlength="8" @input="onShopCart($event,'borderColor')" class="diy-text-btn"></el-input>-->
  129. <!-- </div>-->
  130. <!-- </div>-->
  131. <!-- <div class="shop-cart-row" flex="cross:center">-->
  132. <!-- <div class="leabl">尺寸</div>-->
  133. <!-- <el-radio-group v-model="shopCartSize" @change="onShopCart($event,'sizeType')">-->
  134. <!-- <el-radio :label="item.label" v-for="(item,index) in shopCartSizeList" :key="index">{{item.value}}</el-radio>-->
  135. <!-- </el-radio-group>-->
  136. <!-- </div>-->
  137. <!-- </div>-->
  138. <!-- </diy-style-contain>-->
  139. <!-- <diy-style-contain title="点击购物车按钮" style="padding-top: 0;">-->
  140. <!-- <el-radio-group v-model="addShopCartBtn" @change="onAddShopCartBtn">-->
  141. <!-- <el-radio :label="item.label" v-for="(item,index) in addShopCartBtnList" :key="index">{{item.value}}</el-radio>-->
  142. <!-- </el-radio-group>-->
  143. <!-- </diy-style-contain>-->
  144. <!-- <diy-style-contain title="角标设置" class="fill-border-top">-->
  145. <!-- <el-radio-group v-model="angleMark" @change="onAngleMark">-->
  146. <!-- <el-radio :label="item.label" v-for="(item,index) in angleMarkList" :key="index">{{item.value}}</el-radio>-->
  147. <!-- </el-radio-group>-->
  148. <!-- <div class="shopping-cart-func" v-show="angleMark == 2">-->
  149. <!-- <div class="shop-cart-row" flex="cross:center">-->
  150. <!-- <div class="leabl">样式</div>-->
  151. <!-- <diy-tab v-model="angleMarkStyleList" :default-index="angleMarkStyleIndex" @change="onAngleMarkChange($event, 'angleMarkStyle')">-->
  152. <!-- <template v-slot="{item, isSelect}">-->
  153. <!-- <div flex="cross:center" :class="{'shop-cart-col': true,'selected': isSelect}">-->
  154. <!-- <img :src="item.src" style="width: 28px;">-->
  155. <!-- </div>-->
  156. <!-- </template>-->
  157. <!-- </diy-tab>-->
  158. <!-- </div>-->
  159. <!-- <div class="shop-cart-row" flex="cross:center">-->
  160. <!-- <div class="leabl">文字</div>-->
  161. <!-- <el-input style="flex: 1;" v-model="angleMarkText" placeholder="请输入内容" maxlength="2" size="small" show-word-limit @input="onAngleMarkChange($event, 'angleMarkText')"></el-input>-->
  162. <!-- </div>-->
  163. <!-- </div>-->
  164. <!-- <div class="shopping-cart-func" v-show="angleMark == 3">-->
  165. <!-- <diy-img-setting :img-infos="imageUrl" def-img-count="1" :show-url="false" :suggest-site="2" suggest-size-text="建议图片宽度76,高度76。" :img-contain-style="{padding: 0}" :show-title="false" @change="addIconImg"></diy-img-setting>-->
  166. <!-- </div>-->
  167. <!-- </diy-style-contain>-->
  168. <diy-color class="fill-border-top" :color-infos="defaultForm.colorInfos" :def-color="defaultForm.defColor" @chang="updateColor"></diy-color>
  169. <!-- <diy-size-setting class="fill-border-top" top-name="边距" :size-infos="defaultForm.sizeInfos" :max-value="50" @chang="sliderChange($event, 'margin')"></diy-size-setting>
  170. <diy-size-setting class="fill-border-top" top-name="圆角设置" :size-infos="defaultForm.radiusInfos" :max-value="20" @chang="RadiusChange($event, 'radius')"></diy-size-setting> -->
  171. </div>
  172. </template>
  173. <script>
  174. Vue.component('store-commodity-classify-group-style', {
  175. name: "store-commodity-classify-group-style",
  176. mixins: [basicMixins],
  177. template: '#store-commodity-classify-group-style',
  178. props: {
  179. activeItem: {
  180. type: Object,
  181. default () {
  182. return {}
  183. }
  184. }
  185. },
  186. data() {
  187. return {
  188. showLineList: [{
  189. type: "size",
  190. label: "显示条数",
  191. value: 10,
  192. unit: "个",
  193. maxValue: 20
  194. }, ],
  195. // 选择分类
  196. picktUrlIndex: -1,
  197. selectUrlList:[],
  198. chooseGoods: 1,
  199. defaultSelectList: [],
  200. // 风格
  201. style: 1,
  202. styleList: [{
  203. label: 1,
  204. src: "resources/img/decorate/store-commodity-classify-group/style1.png"
  205. }, {
  206. label: 2,
  207. src: "resources/img/decorate/store-commodity-classify-group/style2.png"
  208. }, {
  209. label: 3,
  210. src: "resources/img/decorate/store-commodity-classify-group/style3.png"
  211. }, {
  212. label: 4,
  213. src: "resources/img/decorate/store-commodity-classify-group/style4.png"
  214. }, {
  215. label: 5,
  216. src: "resources/img/decorate/store-commodity-classify-group/style5.png"
  217. }, {
  218. label: 6,
  219. src: "resources/img/decorate/store-commodity-classify-group/style6.png"
  220. }, {
  221. label: 7,
  222. src: "resources/img/decorate/store-commodity-classify-group/style7.png"
  223. }],
  224. // 选择商品
  225. pickType: ['store_goods','store-commodity-cate'],
  226. pickIndex: -1,
  227. pickImgList: [],
  228. // 显示内容
  229. contentCheckList: [],
  230. /**
  231. {
  232. label: 2,
  233. name: "副标题",
  234. color: "",
  235. showAlpha: false
  236. }
  237. */
  238. showContentList: [{
  239. label: 1,
  240. name: "商品标题",
  241. color: "",
  242. showAlpha: false
  243. }, , {
  244. label: 3,
  245. name: "商品价格",
  246. color: "",
  247. showAlpha: false
  248. }, {
  249. label: 4,
  250. name: "划线原价",
  251. color: "",
  252. showAlpha: false
  253. }, {
  254. label: 5,
  255. name: "商品销量",
  256. color: "",
  257. showAlpha: false
  258. }
  259. , {
  260. label: 6,
  261. name: "会员价",
  262. disableColor: false,
  263. }
  264. ],
  265. // 购物车
  266. shoppingCart: 1,
  267. shopCartStyle: 0,
  268. shopCartStyleList: [{
  269. label: 1,
  270. src: "resources/img/decorate/store-commodity-classify-group/car3.png"
  271. }, {
  272. label: 2,
  273. src: "resources/img/decorate/store-commodity-classify-group/car1.png"
  274. }, {
  275. label: 3,
  276. src: "resources/img/decorate/store-commodity-classify-group/car2.png"
  277. }, {
  278. label: 4,
  279. src: "resources/img/decorate/store-commodity-classify-group/shopping_cart.png"
  280. }, ],
  281. angleMarkStyleIndex: -1,
  282. angleMarkStyleList: [{
  283. label: 1,
  284. src: "resources/img/decorate/store-commodity-classify-group/hot-1.png"
  285. }, {
  286. label: 2,
  287. src: "resources/img/decorate/store-commodity-classify-group/hot-2.png"
  288. }, {
  289. label: 3,
  290. src: "resources/img/decorate/store-commodity-classify-group/hot-3.png"
  291. }, ],
  292. angleMarkText: "",
  293. shopCartText: "",
  294. shopCartRadius: -1,
  295. shopCartBgColor: "",
  296. shopCartColor: "",
  297. shopCartBorderColor: "",
  298. shopCartSize: 1,
  299. shopCartSizeList: [{
  300. label: 1,
  301. value: "小"
  302. }, {
  303. label: 2,
  304. value: "中"
  305. }, {
  306. label: 3,
  307. value: "大"
  308. }],
  309. addShopCartBtn: 1,
  310. addShopCartBtnList: [{
  311. label: 1,
  312. value: "进入商品详情页"
  313. }, {
  314. label: 2,
  315. value: "商品加购"
  316. }],
  317. angleMark: 1,
  318. angleMarkList: [{
  319. label: 1,
  320. value: "不显示"
  321. }, {
  322. label: 2,
  323. value: "系统图标"
  324. }, {
  325. label: 3,
  326. value: "自定义"
  327. }],
  328. imageUrl: []
  329. }
  330. },
  331. computed: {
  332. defaultSelectListIds(newVal) {
  333. var arr = []
  334. if (newVal && newVal.length) {
  335. arr = newVal.map(item => {
  336. return item.params.id
  337. })
  338. }
  339. return arr
  340. },
  341. },
  342. methods: {
  343. changeGoodsList(e){
  344. this.updateData(this.pickImgList, "goods")
  345. },
  346. selectedUrl(value) {
  347. console.log('多选分类`````',value)
  348. this.selectUrlList = value.map(item=>item.params)
  349. this.showLineList[0].value = 10
  350. console.log('数据---`````',this.selectUrlList)
  351. this.updateData(10, 'cateNum')
  352. this.updateData(this.selectUrlList, 'commCate')
  353. },
  354. delClassifyUrl(index) {
  355. this.selectUrlList.splice(index, 1)
  356. // this.updateData(this.pickImgList, "goods") // 选中列表
  357. },
  358. onChange5([{
  359. value
  360. }]) {
  361. this.updateData(value, 'cateNum')
  362. },
  363. init() { // 设置默认值
  364. basicMixins.methods.init.call(this); // 以前的数据调用一下
  365. let arr10 = ['computedStyle', 'iptBg']
  366. var comBgColor = {
  367. name: '商品背景', //名字
  368. color: getObjValue(this.result, arr10, this.defaultForm.defColor), //颜色
  369. showAlpha: false, //是否开启透明度
  370. }
  371. // 更改mixins初始数据
  372. this.defaultForm.colorInfos.push(comBgColor)
  373. // ======================== 首次初始渲染
  374. let count = 10
  375. let { commCate } = this.result.data
  376. if(commCate){
  377. if(Array.isArray(commCate)){
  378. this.selectUrlList = commCate
  379. count = getObjValue(this.result, ['data', 'cateNum'], 10)
  380. }else { //兼容原有逻辑
  381. count = getObjValue(this.result, ['data', 'commCate', 'count'], 10)
  382. this.selectUrlList = [commCate]
  383. }
  384. }
  385. console.log('count----------------',count,this.result)
  386. this.showLineList = [{
  387. type: "size",
  388. label: "显示条数",
  389. value: count,
  390. unit: "个",
  391. maxValue: 20
  392. }]
  393. this.chooseGoods = this.result.data.chooseGoods || 1
  394. // 风格
  395. this.style = this.result.data.style || 1
  396. this.onStyleList(this.style) // 更新视图
  397. // 选择商品
  398. let arr = ['data', 'goods']
  399. this.pickImgList = getObjValue(this.result, arr, [])
  400. this.defaultSelectList = getObjValue(this.result, arr, []);
  401. // 显示内容
  402. let arr1 = ['data', 'showContent']
  403. let contentCheckList = getObjValue(this.result, arr1)
  404. if (contentCheckList && contentCheckList.length) {
  405. this.showContentList = this.showContentList.map((item) => {
  406. let item1 = contentCheckList.find(item1 => {
  407. return item.label == item1.label && item1.color
  408. })
  409. if (item1) {
  410. item.color = item1.color
  411. }
  412. return item
  413. })
  414. }
  415. this.contentCheckList = contentCheckList ? contentCheckList.map(item => (item.label)) : [1, 2, 3, 4, 5, 6]
  416. this.filterSelectContentList()
  417. // 购物车
  418. this.shoppingCart = this.result.data.showShopCart || 1
  419. let arr2 = ['data', 'shopCartStyle']
  420. let arr3 = ['computedStyle', 'shopCartStyle']
  421. let shopCartData = getObjValue(this.result, arr2, {
  422. index: 0,
  423. text: "",
  424. })
  425. let shopCartStyle = getObjValue(this.result, arr3, {
  426. color: "",
  427. borderReduis: 0,
  428. backgroundColor: "",
  429. borderColor: "",
  430. sizeType: 1
  431. })
  432. this.shopCartStyle = shopCartData.index || 0
  433. this.onShopCartStyle({}, this.shopCartStyle)
  434. this.shopCartText = shopCartData.text || ""
  435. this.shopCartColor = shopCartStyle.color || ""
  436. this.shopCartRadius = shopCartStyle.borderReduis || 0
  437. this.shopCartBgColor = shopCartStyle.backgroundColor || ""
  438. this.shopCartBorderColor = shopCartStyle.borderColor || ""
  439. this.shopCartSize = shopCartStyle.sizeType || 1
  440. // 购物车跳转
  441. let clickShopCartObJ = this.result.data.clickShopCartType
  442. this.addShopCartBtn = clickShopCartObJ ? clickShopCartObJ.label : 1
  443. // 角标
  444. let arr4 = ['data', 'angleMark']
  445. let angleMark = getObjValue(this.result, arr4, {})
  446. this.angleMark = angleMark.label || 1
  447. this.angleMarkText = angleMark.angleMarkText || ""
  448. if (angleMark.customImgUrl) {
  449. this.imageUrl.push({
  450. imgUrl: angleMark.customImgUrl
  451. })
  452. }
  453. let arr5 = ['data', 'angleMark', 'angleMarkStyle']
  454. let angleMarkStyle = getObjValue(this.result, arr5, {
  455. label: 0,
  456. src: "resources/img/decorate/store-commodity-classify-group/hot-2.png"
  457. })
  458. this.angleMarkStyleIndex = angleMarkStyle.label
  459. // 尺寸
  460. let siazArr = ['computedStyle', 'searchIpts', 'marginBottom']
  461. let siazArr1 = ['computedStyle', 'searchIpts', 'marginLeft']
  462. let siazArr2 = ['computedStyle', 'searchIpts', 'marginTop']
  463. var marginArr = [{
  464. name: '上边距', //名字
  465. value: parseFloat(getObjValue(this.result, siazArr2, 10)), //值
  466. unit: "px", //单位
  467. disabled: false, //是否禁用
  468. maxValue: 50,
  469. }, {
  470. name: '下边距', //名字
  471. value: parseFloat(getObjValue(this.result, siazArr, 10)), //值
  472. unit: "px", //单位
  473. disabled: false, //是否禁用
  474. maxValue: 50,
  475. }, {
  476. name: '左右边距', //名字
  477. value: parseFloat(getObjValue(this.result, siazArr1, 10)), //值
  478. unit: "px", //单位
  479. disabled: false, //是否禁用
  480. maxValue: 20,
  481. }]
  482. this.defaultForm.sizeInfos = marginArr
  483. this.sliderChange(marginArr, 'margin')
  484. this.setDefaultSelectIds();
  485. },
  486. getContentItem(label) {
  487. return this.showContentList.find(item => {
  488. return item && (item.label === label)
  489. }) || {}
  490. },
  491. onStyleList($event) {
  492. // 更改操作
  493. if ($event == 1 || $event == 2) {
  494. this.showContentList = [{
  495. label: 1,
  496. name: "商品标题",
  497. color: this.getContentItem(1).color,
  498. showAlpha: false
  499. }, {
  500. label: 2,
  501. name: "副标题",
  502. color: this.getContentItem(2).color,
  503. showAlpha: false
  504. }, {
  505. label: 3,
  506. name: "商品价格",
  507. color: this.getContentItem(3).color,
  508. showAlpha: false
  509. }, {
  510. label: 4,
  511. name: "划线原价",
  512. color: this.getContentItem(4).color,
  513. showAlpha: false
  514. }, {
  515. label: 5,
  516. name: "商品销量",
  517. color: this.getContentItem(5).color,
  518. showAlpha: false
  519. }
  520. , {
  521. label: 6,
  522. name: "会员价",
  523. disableColor: false,
  524. }
  525. ]
  526. } else if ($event == 3) {
  527. this.showContentList = [{
  528. label: 1,
  529. name: "商品标题",
  530. color: this.getContentItem(1).color,
  531. showAlpha: false
  532. }, {
  533. label: 3,
  534. name: "商品价格",
  535. color: this.getContentItem(3).color,
  536. showAlpha: false
  537. }, {
  538. label: 4,
  539. name: "划线原价",
  540. color: this.getContentItem(4).color,
  541. showAlpha: false
  542. }, {
  543. label: 5,
  544. name: "商品销量",
  545. color: this.getContentItem(5).color,
  546. showAlpha: false
  547. }
  548. , {
  549. label: 6,
  550. name: "会员价",
  551. disableColor: false,
  552. }
  553. ]
  554. } else {
  555. this.showContentList = [{
  556. label: 1,
  557. name: "商品标题",
  558. color: this.getContentItem(1).color,
  559. showAlpha: false
  560. }, {
  561. label: 3,
  562. name: "商品价格",
  563. color: this.getContentItem(3).color,
  564. showAlpha: false
  565. }, ]
  566. }
  567. this.updateData($event, 'style')
  568. },
  569. onAngleMark(e) {
  570. var item = this.angleMarkList.find(it => {
  571. return it.label == e
  572. })
  573. this.updateData(item, "angleMark")
  574. },
  575. onAngleMarkChange(e, type) {
  576. this.updateData({
  577. [type]: e
  578. }, "angleMark")
  579. },
  580. // 图片
  581. addIconImg(arr) {
  582. this.imageUrl = arr
  583. this.updateData({
  584. customImgUrl: arr[0].imgUrl
  585. }, "angleMark")
  586. },
  587. onAddShopCartBtn(e) {
  588. var item = this.addShopCartBtnList.find(it => {
  589. return it.label == e
  590. })
  591. this.updateData(item, "clickShopCartType")
  592. },
  593. updateShopCartText(text) {
  594. this.updateData({
  595. text
  596. }, "shopCartStyle")
  597. },
  598. onShopCartStyle(e, index) {
  599. this.shopCartStyle = index
  600. this.updateData(Object.assign({
  601. index
  602. }, e), "shopCartStyle")
  603. },
  604. onShopCart(e, type) {
  605. this.updateStyle({
  606. [type]: e
  607. }, "shopCartStyle")
  608. },
  609. updateInput(val, item) {
  610. if (val.length == 0) {
  611. val = "transparent";
  612. }
  613. item.color = val
  614. // 更新
  615. },
  616. onContentChange() {
  617. this.filterSelectContentList()
  618. },
  619. onPickColor() {
  620. // 更新
  621. this.filterSelectContentList()
  622. },
  623. filterSelectContentList() {
  624. var result = this.showContentList.filter(item => {
  625. return this.contentCheckList.indexOf(item.label) !== -1
  626. })
  627. this.updateData(result, "showContent") // 选中列表
  628. },
  629. mouseenter(index) {
  630. this.pickIndex = index
  631. },
  632. mouseleave() {
  633. this.pickIndex = -1
  634. },
  635. delModel(index) {
  636. this.pickImgList.splice(index, 1)
  637. this.defaultSelectList.splice(index, 1);
  638. this.updateData(this.pickImgList, "goods") // 选中列表
  639. },
  640. selectNavUrl(e) {
  641. let tempList =[...this.pickImgList,...e]
  642. this.pickImgList = tempList.filter((item, index, self) => {
  643. return self.findIndex(t => t.params.id === item.params.id) === index;
  644. });
  645. this.updateData(this.pickImgList, "goods") // 选中列表
  646. this.setDefaultSelectIds();
  647. },
  648. setDefaultSelectIds() {
  649. let pickData = this.pickImgList;
  650. let selectIds = [];
  651. pickData.forEach(item => {
  652. selectIds.push(item.params.id);
  653. })
  654. this.defaultSelectList = selectIds.filter((item, index, selectIds) => selectIds.indexOf(item) === index);
  655. },
  656. updateColor(e) { // 选择颜色
  657. this.result.computedStyle.searchBox = e[0].color
  658. this.result.computedStyle.iptBg = e[1].color
  659. this.$emit("update", this.result)
  660. },
  661. upImgIndex(index, item) {
  662. this.imgIndex = index;
  663. this.result.data.titleStyle = item;
  664. this.$emit("update", this.result);
  665. },
  666. isObject(d) {
  667. if (!d) {
  668. return false
  669. }
  670. return Object.prototype.toString.call(d) === "[object Object]"
  671. },
  672. // 更新数据
  673. updateData(value, key) {
  674. if (this.isObject(this.result.data[key])) { // 对象格式
  675. var oldData = deepClone(this.result.data[key])
  676. this.result.data[key] = Object.assign(oldData, {
  677. ...value
  678. });
  679. } else { // 基础类型、数组
  680. this.result.data[key] = value;
  681. }
  682. this.$emit("update", this.result);
  683. },
  684. updateStyle(value, key) {
  685. if (this.isObject(this.result.computedStyle[key])) { // 对象格式
  686. var oldData = deepClone(this.result.computedStyle[key])
  687. this.result.computedStyle[key] = Object.assign(oldData, {
  688. ...value
  689. });
  690. } else { // 基础类型、数组
  691. this.result.computedStyle[key] = value;
  692. }
  693. this.$emit("update", this.result);
  694. },
  695. }
  696. });
  697. </script>
  698. <style lang="scss" >
  699. .pickImgItem {
  700. position: relative;
  701. width: 50px;
  702. height: 50px;
  703. margin: 0 9px 9px 0;
  704. background-color: #ddd;
  705. }
  706. .pickImgItem .el-icon-close {
  707. position: absolute;
  708. top: 0;
  709. right: 0;
  710. font-size: 12px;
  711. }
  712. .add-goods-btn {
  713. border: 1px dashed #6b7685;
  714. line-height: 32px;
  715. height: 32px;
  716. border-radius: 4px;
  717. text-align: center;
  718. cursor: pointer;
  719. }
  720. .pick-goods {
  721. background: #f4f3f7;
  722. border-radius: 4px;
  723. padding: 20px;
  724. }
  725. .tip {
  726. position: absolute;
  727. top: 21px;
  728. left: 88px;
  729. font-size: 12px;
  730. color: rgb(153, 153, 153);
  731. }
  732. .show-content-pick {
  733. margin: 0 10px 0 12px;
  734. }
  735. .shoppingCartFunc {
  736. background: #f4f3f7;
  737. border-radius: 4px;
  738. padding: 20px;
  739. margin-top: 20px;
  740. }
  741. .shopping-cart-func {
  742. margin-top: 20px;
  743. }
  744. .shop-cart-row .leabl {
  745. width: 70px;
  746. text-align: center;
  747. }
  748. .shop-cart-col {
  749. width: 36px;
  750. height: 36px;
  751. box-sizing: border-box;
  752. justify-content: center;
  753. border-radius: 4px;
  754. margin-right: 20px;
  755. }
  756. .selected {
  757. border: 1px solid var(--diy-theme);
  758. }
  759. /* 清理组件默认样式 */
  760. .clear-diy-style .el-radio-button__inner {
  761. background-color: transparent;
  762. padding: 0;
  763. }
  764. .shop-cart-row .el-radio-group {
  765. display: flex;
  766. align-items: center;
  767. }
  768. .shop-cart-row .el-radio-button__inner {
  769. display: flex;
  770. width: 42px;
  771. height: 42px;
  772. align-items: center;
  773. justify-content: center;
  774. background-color: transparent;
  775. padding: 0;
  776. }
  777. .shop-cart-row {
  778. margin-bottom: 20px;
  779. }
  780. .clear-diy-style .com-pick-link-content {
  781. width: 100%;
  782. }
  783. .store-commodity-classify-group-style .show-content .el-color-picker {
  784. height: 30px;
  785. }
  786. .store-commodity-classify-group-style .el-checkbox {
  787. width: 100px;
  788. }
  789. /* 修改element基础样式 */
  790. .store-commodity-classify-group-style .el-radio-button__orig-radio:checked+.el-radio-button__inner {
  791. background-color: transparent;
  792. }
  793. .store-commodity-classify-group-style {
  794. .icon-set-items {
  795. position: relative;
  796. .icon-set-items-close {
  797. position: absolute;
  798. right: 10px;
  799. top: 10px;
  800. }
  801. }
  802. }
  803. </style>