style1.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. <template id="goods-info-style1">
  2. <div class="goods-info-style1">
  3. <div class="goods-card">
  4. <div class="price-box" flex="main:justify cross:center">
  5. <div style="flex: 1;">
  6. <div class="price-line" flex="cross:bottom" v-if="getShowTags('price')">
  7. <div class="price">
  8. ¥<span class="amount">88</span>
  9. </div>
  10. <div class="origin-price">¥99</div>
  11. </div>
  12. </div>
  13. <div class="goods-share" flex="cross:center">
  14. <div class="share-item" flex="dir:top main:center cross:center" v-if="getShowTags('share')">
  15. <i class="iconfont icon-QR_code share-icons"></i>
  16. <div class="share-title">分享</div>
  17. </div>
  18. <div class="share-item" flex="dir:top main:center cross:center" v-if="getShowTags('collect')">
  19. <i class="iconfont icon-shoucang1 share-icons"></i>
  20. <div class="share-title">收藏</div>
  21. </div>
  22. </div>
  23. </div>
  24. <div v-if="getShowTags('memberPrice')" class="member-price-container">
  25. <span>
  26. <img src="resources/img/decorate/commodity-group/mp.png">
  27. </span>
  28. <span class="member-price-title">会员价</span>
  29. <span class="member-price-title">¥73<span>
  30. </div>
  31. <div class="goods-title" v-if="getShowTags('title')">商品标题</div>
  32. <div class="goods-subtitle" v-if="getShowTags('subtitle')">商品副标题</div>
  33. <div v-if="addonsFields.length > 0">
  34. <div v-for="(value, index) in addonsFields">
  35. <div v-if="getShowTags(value['type'])" class="addons-fields-style">
  36. <span>{{value.prefix_text}}{{value.name}}{{value.value}}</span>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="addons-fields-style" v-if="getShowTags('scoreDeduct')">
  41. 可用积分抵扣25元
  42. </div>
  43. <div class="goods-express" flex>
  44. <div class="express-item" v-if="getShowTags('sale')">销量:22</div>
  45. <div class="express-item" v-if="!global_goods_need&&getShowTags('stock')">库存:22</div>
  46. </div>
  47. <div class=" goods-cell-item goods-line-item" flex="cross:center" v-if="!global_goods_need&&getShowTags('coupon')">
  48. <div class="cell-title">领券</div>
  49. <div class="cell-cont" flex>
  50. <div class="cell-coupon">满25立减9.9元</div>
  51. <div class="cell-coupon">满50立减10元</div>
  52. </div>
  53. </div>
  54. <div v-if="!global_goods_need" class="goods-cell-item" flex="cross:center">
  55. <div class="cell-title">已选</div>
  56. <div class="cell-cont">默认</div>
  57. <i class="el-icon-arrow-right"></i>
  58. </div>
  59. <!-- 商品标签 -->
  60. <div v-if="getShowTags('shopTag')" class="goods-cell-item" flex="cross:center">
  61. <div class="cell-title">商品标签</div>
  62. <div class="shopLabelContent">
  63. <div class="shopLabel" v-for="(item, index) in shopTags" :key="index">
  64. <span class="label-text">{{item}}</span>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="goods-cell-item" flex="cross:center" v-if="!global_goods_need &&getShowTags('serve')">
  69. <div class="cell-title">服务</div>
  70. <div class="cell-cont" flex>
  71. <div class="serve-item" v-for="(it, i) in serveList" :key="i">
  72. <i class="el-icon-circle-check cell-color-r"></i>
  73. <span>{{ it }}</span>
  74. </div>
  75. </div>
  76. </div>
  77. <!-- 商品说明 -->
  78. <div class="goods-cell-desc" v-if="getShowTags('goodsDesc')">
  79. <div class="cell-title">商品说明</div>
  80. <div class="cell-cont">
  81. <div class="desc-item">
  82. 药品名称:文本内容文本内容文本内容文本内
  83. </div>
  84. <div class="desc-item">
  85. 药品编码:5631441360230
  86. </div>
  87. <div class="desc-item">
  88. 医药编码:文本内容文本内容文本内容文本内容文本内容...
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </template>
  95. <script>
  96. /**
  97. * @descriptions
  98. * 1. 组件名字必须对应模板形式 - 递归组件name
  99. * 2. 样式内容方法尽量内部维护 - 前端方便通用
  100. * 3. 父级组件会传预览数据 - activeItem
  101. */
  102. Vue.component('goods-info-style1', {
  103. name: "goods-info-style1",
  104. props: {
  105. activeItem: {
  106. type: Object,
  107. default () {
  108. return {}
  109. }
  110. },
  111. goodsData: {
  112. type: Object,
  113. default () {
  114. return {}
  115. }
  116. }
  117. },
  118. template: '#goods-info-style1',
  119. data() {
  120. return {
  121. shopTags: ["标签1", "标签2", "标签3", "标签4", "标签5", "标签6", "标签7", "标签8", "标签9", "标签10"],
  122. serveList: ['7天包退换', '全国包邮'],
  123. global_goods_need: 0,
  124. addonsFields: []
  125. }
  126. },
  127. mounted() {
  128. this.getDetail()
  129. this.getAddonsFields()
  130. },
  131. methods: {
  132. getShowTags(name) {
  133. let arr = this.goodsData.checkList
  134. let i = arr.findIndex(item => item == name)
  135. return i == -1 ? false : true
  136. },
  137. getDetail() {
  138. let self = this;
  139. self.cardLoading = true;
  140. request({
  141. params: {
  142. r: 'mall/decorate/setting',
  143. },
  144. method: 'get',
  145. }).then(e => {
  146. self.cardLoading = false;
  147. if (e.data.code == 0) {
  148. if (!isEmpty(e.data.data) && e.data.data.global_goods_need) {
  149. this.global_goods_need = e.data.data.global_goods_need
  150. }
  151. } else {
  152. self.$message.error(e.data.msg);
  153. }
  154. }).catch(e => {
  155. console.log(e);
  156. });
  157. },
  158. getAddonsFields() {
  159. request({
  160. params: {
  161. r: 'mall/diy/get-addons-fields',
  162. type: 'goods_detail'
  163. },
  164. method: 'get',
  165. }).then(e => {
  166. this.dialogLoading = false;
  167. if (e.data.code === 0) {
  168. if (e.data.data.length > 0) {
  169. let self = this;
  170. e.data.data.forEach(function(value, index, arr) {
  171. self.addonsFields.push({
  172. name: value['name'],
  173. type: value['type'],
  174. prefix_text: value['prefix_text'],
  175. value: '25.00'
  176. })
  177. })
  178. }
  179. }
  180. }).catch(e => {
  181. console.log(e);
  182. });
  183. }
  184. }
  185. });
  186. </script>
  187. <style scoped>
  188. .cell-color-r {
  189. color: #DB0505;
  190. }
  191. .goods-card {
  192. position: relative;
  193. width: 100%;
  194. background-color: #fff;
  195. /* margin: auto;
  196. margin-top: -20px;
  197. border-radius: 5px; */
  198. padding: 10px 12px 5px;
  199. }
  200. .goods-info-style1 .price-line {
  201. font-size: 16px;
  202. /* padding-bottom: 18px; */
  203. }
  204. .goods-info-style1 .price-line .price {
  205. font-weight: 700;
  206. color: #DB0505;
  207. }
  208. .goods-info-style1 .price-line .price .amount {
  209. font-size: 28px;
  210. }
  211. .goods-info-style1 .price-line .origin-price {
  212. color: #999;
  213. text-decoration: line-through;
  214. padding-left: 10px;
  215. padding-bottom: 5px;
  216. }
  217. .goods-info-style1 .goods-title {
  218. font-size: 16px;
  219. font-weight: 700;
  220. padding: 8px 0;
  221. }
  222. .goods-info-style1 .goods-subtitle {
  223. font-size: 14px;
  224. color: #b0b3bf;
  225. /* padding-bottom: 8px; */
  226. }
  227. .goods-info-style1 .goods-express {
  228. position: relative;
  229. line-height: 36px;
  230. color: #b0b3bf;
  231. font-size: 12px;
  232. }
  233. .goods-info-style1 .goods-express .express-item {
  234. width: 33.3%;
  235. }
  236. .goods-info-style1 .goods-express:before {
  237. position: absolute;
  238. content: "";
  239. left: -12px;
  240. right: -12px;
  241. top: 0;
  242. border-top: 1px dashed #ededed;
  243. }
  244. .goods-line-item {
  245. position: relative;
  246. }
  247. .goods-cell-item .cell-title {
  248. color: #808080;
  249. font-size: 12px;
  250. font-weight: 700;
  251. }
  252. .goods-cell-item .cell-cont {
  253. flex: 1;
  254. margin-left: 20px;
  255. padding: 15px 0;
  256. font-size: 14px;
  257. }
  258. .goods-cell-item .cell-cont .cell-coupon {
  259. padding: 2px 12px;
  260. font-size: 12px;
  261. color: #fff;
  262. border-radius: 12px;
  263. margin-right: 8px;
  264. flex-shrink: 0;
  265. background-color: #DB0505;
  266. }
  267. .goods-line-item:before {
  268. position: absolute;
  269. content: "";
  270. left: -12px;
  271. right: -12px;
  272. bottom: 0;
  273. border-top: 1px solid #ededed;
  274. }
  275. .goods-cell-item .shopLabelContent {
  276. display: flex;
  277. margin-left: 2.5px;
  278. /* 设置容器宽度为300px,当内容超出容器宽度时显示横向滚动条 */
  279. max-width: 300px;
  280. /* 当内容超出容器宽度时显示横向滚动条 */
  281. overflow-x: auto;
  282. /* 防止标签换行 */
  283. white-space: nowrap;
  284. /* 隐藏滚动条 - 兼容火狐 */
  285. scrollbar-width: none;
  286. /* 隐藏滚动条 - 兼容IE */
  287. -ms-overflow-style: none;
  288. }
  289. /* 隐藏滚动条 - 兼容WebKit浏览器 */
  290. .goods-cell-item .shopLabelContent::-webkit-scrollbar {
  291. display: none;
  292. }
  293. .goods-cell-item .shopLabelContent .shopLabel {
  294. font-size: 12px;
  295. color: #DB0505;
  296. padding: 2px 4px;
  297. border-radius: 5px;
  298. border: 0.5px solid #DB0505;
  299. margin: 0 2.5px;
  300. }
  301. .goods-cell-item .shopLabelContent .shopLabel .label-text {
  302. font-size: 12px;
  303. }
  304. .goods-cell-item .cell-cont .serve-item {
  305. margin-right: 20px;
  306. color: #535353;
  307. }
  308. .goods-share {
  309. /* position: absolute;
  310. top: 15px;
  311. right: 5px; */
  312. }
  313. .goods-share .share-item {
  314. height: 45px;
  315. width: 45px;
  316. color: #333;
  317. border-radius: 50%;
  318. background: #f5f5f5;
  319. margin-right: 5px;
  320. }
  321. .share-icons {
  322. font-weight: 700;
  323. }
  324. .share-title {
  325. font-size: 11px;
  326. transform: scale(0.7);
  327. }
  328. .member-price-container {
  329. display: flex;
  330. align-items: center;
  331. }
  332. .member-price-title {
  333. font-size: 16px;
  334. padding-left: 3px;
  335. }
  336. div.addons-fields-style {
  337. color: gray;
  338. padding-top: 6px;
  339. }
  340. .goods-cell-desc:before {
  341. position: absolute;
  342. content: "";
  343. left: -12px;
  344. right: -12px;
  345. bottom: 105px;
  346. border-top: 5px solid #ededed;
  347. }
  348. .goods-cell-desc:after {
  349. position: absolute;
  350. content: "";
  351. left: -12px;
  352. right: -12px;
  353. bottom: 0;
  354. border-top: 5px solid #ededed;
  355. }
  356. .goods-cell-desc {
  357. position: relative;
  358. padding: 16px 0;
  359. }
  360. .goods-cell-desc .cell-title {
  361. color: #333333;
  362. text-align: left;
  363. font-size: 28rpx;
  364. font-weight: 600;
  365. }
  366. .goods-cell-desc .desc-item {
  367. width: 686rpx;
  368. height: 39rpx;
  369. opacity: 1;
  370. color: #999999;
  371. text-align: left;
  372. font-size: 26rpx;
  373. font-weight: 400;
  374. font-family: "SF Pro Text";
  375. line-height: 39rpx;
  376. }
  377. </style>