contrast.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867
  1. <template>
  2. <app-layout>
  3. <view class="player" v-if="show_catList">
  4. <view class="player-content">
  5. <view class="player-title">请选择品牌</view>
  6. <view class="player-search">
  7. <view class="input"><input type="text" placeholder="请输入商品名称" v-model="player_search"/></view>
  8. <view class="btn" @click="getShop()">搜索</view>
  9. </view>
  10. <view class="player-list">
  11. <view class="player-item" v-for="(item,index) of cat_list"
  12. @click="getShop(item.id)"
  13. :key="index">
  14. {{item.name}}
  15. </view>
  16. </view>
  17. <view class="player-close" @click="hidden_catList">关闭</view>
  18. </view>
  19. </view>
  20. <view class="player player-one" v-if="show_cat">
  21. <view class="player-content">
  22. <view class="player-title">请选择分类商品</view>
  23. <view class="player-search">
  24. <view class="input"><input type="text" placeholder="请输入商品名称" v-model="player_search"/></view>
  25. <view class="btn" @click="getShop()">搜索</view>
  26. </view>
  27. <view class="player-list">
  28. <view class="player-item" v-for="(item,index) of cat_list_one"
  29. @click="addContrast(item.goods_id)"
  30. :key="index">
  31. <view class="player-left"><img :src="item.cover_pic" /></view>
  32. <view class="player-right">
  33. <view class="player-name">{{item.name}}</view>
  34. <view class="player-price">¥{{item.price}}</view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="player-close" @click="hidden_cat">关闭</view>
  39. </view>
  40. </view>
  41. <template v-if="goods">
  42. <view style="width:100%;overflow-x:scroll;">
  43. <view class="contrast" style="width:772px;">
  44. <view class="title">隐藏相同属性</view>
  45. <view class="colmun" v-if="contrastList">
  46. <view class="list" v-if="contrastList.info">
  47. <view class="contrast_item">
  48. <view class="contrast_key">商品信息</view>
  49. <view class="contrast_key" :class="'contrast_key'+(index+2)" v-for="(item,index) of contrastList.info" :key="index">
  50. <view class="pic"><img alt="手机图片" :src="item.cover_pic" /></view>
  51. <view class="name">{{item.name}}</view>
  52. <view class="price">¥{{item.price}}</view>
  53. <view class="buy" @click="goBuy(item.id,item.type)">立即购买</view>
  54. <view class="cancel"
  55. :class="{unable:index==0}"
  56. @click="cancel(item.id,index)">移除</view>
  57. </view>
  58. <view class="contrast_key" :class="'contrast_key'+(index+2)" v-for="(item,index) of (4 - contrastList.info.length)" :key="index">
  59. <view class="buy" @click="getShopList()">添加商品</view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="list" v-for="(item,index) of contrastList.list" :key="index" v-if="contrastList.list" style="width:772px;float:left;">
  64. <view class="contrast_title" v-if="item.length>0">{{item[0].title}}</view>
  65. <view class="contrast_item" v-for="(value,key) of item" :key="key">
  66. <view class="contrast_key" :class="'contrast_key'+(ind+1)" v-for="(ite,ind) of value.text" :key="ind">
  67. {{ite}}
  68. </view>
  69. <view class="contrast_key" :class="'contrast_key'+(ind+1)" v-for="(ite,ind) of (5 - value.text.length)" :key="ind">
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. <u-attr
  77. v-if="is_negotiable === 0 && exchangeStatus ==null"
  78. v-model="attrShow"
  79. :goods="goods"
  80. :themeObject="themeObject"
  81. :checked="checked"
  82. @check="check"
  83. >
  84. </u-attr>
  85. </template>
  86. </app-layout>
  87. </template>
  88. <script>
  89. import {mapGetters, mapState} from "vuex";
  90. import appGoodsBanner from "../../components/page-component/goods/app-goods-banner.vue";
  91. import appGoodsRecommend from "../../components/page-component/app-goods-recommend/app-goods-recommend.vue";
  92. import appQuickNavigation from "../../components/page-component/app-quick-navigation/app-quick-navigation.vue";
  93. import appComposition from'../../components/basic-component/app-composition/app-composition.vue';
  94. import AppVipCard from '../../components/page-component/app-vip-card/app-vip-card';
  95. import uniSwiperDot from '../../components/basic-component/uni-swiper-dot/uni-swiper-dot';
  96. import appGoodsFlashSale from '../../components/page-component/goods/app-goods-flash-sale.vue';
  97. import uAttr from '../../components/page-component/goods/u-attr.vue';
  98. import appGoodsFullReduce from '../../components/page-component/goods/app-goods-full-reduce.vue';
  99. import bdInfo from '@/components/page-component/goods/bd-info';
  100. import bdCoupon from '@/components/page-component/goods/bd-coupon.vue';
  101. import bdXbc from '@/components/page-component/goods/bd-xbc.vue';
  102. import bdKb from '@/components/page-component/goods/bd-kb.vue';
  103. import bdHc from '@/components/page-component/goods/bd-hc.vue';
  104. import bdDetail from '@/components/page-component/goods/bd-detail.vue';
  105. import bdComments from '@/components/page-component/goods/bd-comments.vue';
  106. import appClose from '@/components/basic-component/app-close/app-close.vue';
  107. export default {
  108. name: "goods",
  109. components: {
  110. appGoodsBanner,
  111. 'app-goods-recommend': appGoodsRecommend,
  112. 'app-quick-navigation': appQuickNavigation,
  113. 'app-composition': appComposition,
  114. appClose,
  115. uniSwiperDot,
  116. AppVipCard,
  117. appGoodsFlashSale,
  118. appGoodsFullReduce,
  119. uAttr,
  120. bdInfo,
  121. bdCoupon,
  122. bdXbc,
  123. bdKb,
  124. bdHc,
  125. bdDetail,
  126. bdComments
  127. },
  128. data() {
  129. return {
  130. contrastList:null, //对比参数列表
  131. contrastApi:this.$api.poster.goods_contrast,
  132. catListApi:this.$api.poster.cat_list,
  133. searchApi:this.$api.poster.search,
  134. catApi:this.$api.poster.cat,
  135. player_search:'',
  136. cat_id:null, //购物车类型id-父级
  137. cat_list:null, //购物车列表
  138. cat_list_one:null, //商品列表
  139. show_catList:false, //是否显示推荐商品类型列表
  140. show_cat:false, //显示商品列表
  141. attrShow:false,
  142. showClose: false,
  143. is_open: 0,
  144. goods: null,
  145. selectAttr: null,
  146. recommend_list: null,
  147. is_vip: false,
  148. is_vip_card_user: 0,
  149. current: 0,
  150. discount: null,
  151. attrShow: false,
  152. shareData: null,
  153. contact_tel:'',
  154. contact: '',
  155. contact_web:'',
  156. poster_config: this.$api.goods.poster,
  157. poster_generate: this.$api.poster.goods_new,
  158. // 限时抢购
  159. flash_sale: null,
  160. checked: null,
  161. // 商品服务
  162. services: null,
  163. // 商品详情
  164. detail: null,
  165. // 商品ID
  166. goodsId: null,
  167. // 套餐组合
  168. composition: null,
  169. autoplay: true,
  170. full_reduce: null,
  171. goods_marketing_award: null,
  172. express: null,
  173. goods_marketing: null,
  174. exchangeStatus: null,
  175. exchange: null,
  176. price: null,
  177. level_show: null,
  178. sales: null,
  179. unit: null,
  180. is_sales: null,
  181. extra_quick_share: null,
  182. price_max: null,
  183. price_min: null,
  184. price_member_max: null,
  185. price_member_min: null,
  186. original_price: null,
  187. subtitle: null,
  188. is_negotiable: null,
  189. name: null,
  190. app_share_pic: null,
  191. app_share_title: null,
  192. goodsType: null,
  193. favorite: null,
  194. goods_coupon_center: null,
  195. guarantee_title: null,
  196. guarantee_pic: null,
  197. param_content: null,
  198. param_name: null,
  199. attr_groups: null,
  200. goods_num: null,
  201. good_stock: null
  202. };
  203. },
  204. computed: {
  205. themeObject:function() {
  206. return {
  207. back: this.getTheme + '-m-back ' + this.getTheme,
  208. backP: this.getTheme + '-m-back-p ' + this.getTheme,
  209. backO: this.getTheme + '-m-back-o ' + this.getTheme,
  210. theme: this.getTheme,
  211. color: this.getTheme + '-m-text ' + this.getTheme,
  212. sBack: this.getTheme + '-s-back ' + this.getTheme,
  213. border: this.getTheme + '-m-border ' + this.getTheme,
  214. }
  215. },
  216. ...mapState({
  217. mall: state => state.mallConfig.mall,
  218. gConfig: state => state.gConfig,
  219. }),
  220. ...mapGetters('mallConfig', {
  221. getTheme: 'getTheme',
  222. }),
  223. good_negotiable: function() {
  224. let good_negotiable = this.mall.setting.good_negotiable;
  225. this.contact_tel = '';
  226. this.contact = '';
  227. this.contact_web = '';
  228. let arr = [];
  229. for (let i = 0; i < good_negotiable.length; i++) {
  230. if (good_negotiable[i] === 'contact_tel') {
  231. this.contact_tel = 'contact_tel';
  232. }
  233. if (good_negotiable[i] === 'contact') {
  234. this.contact = 'contact';
  235. }
  236. if (good_negotiable[i] === 'contact_web') {
  237. this.contact_web = 'contact_web';
  238. }
  239. }
  240. if (this.contact_tel) {
  241. arr.push(this.contact_tel);
  242. }
  243. if (this.contact) {
  244. arr.push(this.contact);
  245. }
  246. if (this.contact_web) {
  247. arr.push(this.contact_web);
  248. }
  249. return arr;
  250. },
  251. contactBtn: function() {
  252. const len = this.good_negotiable.length;
  253. const theme = this.getTheme;
  254. if (len === 3 && (theme === 'a' || theme === 'b' || theme === 'f')) {
  255. return `${theme}-m-back ${theme}-s-text ${theme}`;
  256. } else if (len === 3 && !(theme === 'a' || theme === 'b' || theme === 'f')) {
  257. return `${theme}-m-back ${theme}-s-text ${theme}`;
  258. } if (len === 2 && (theme === 'a' || theme === 'b' || theme === 'f') && !this.contact_tel) {
  259. return `${theme}-s-back text ${theme}`;
  260. } else if (len === 2 && (theme === 'a' || theme === 'b' || theme === 'f') && this.contact_tel) {
  261. return `${theme}-m-back ${theme}-s-text ${theme}`;
  262. } else if (len === 2 && !(theme === 'a' || theme === 'b' || theme === 'f') && !this.contact_tel) {
  263. return `${theme}-s-back text ${theme}`;
  264. } else if (len === 2 && !(theme === 'a' || theme === 'b' || theme === 'f') && this.contact_tel) {
  265. return `${theme}-m-back ${theme}-s-text ${theme}`;
  266. } else {
  267. return `${theme}-m-back ${theme}-s-text ${theme}`;
  268. }
  269. }
  270. },
  271. onLoad(options) {
  272. // #ifdef MP-WEIXIN
  273. wx.showShareMenu({
  274. menus: ['shareAppMessage', 'shareTimeline']
  275. })
  276. // #endif
  277. if (this.isLogin) {
  278. this.$store.dispatch('user/info');
  279. } else {
  280. }
  281. if(options.exchange) {
  282. this.exchangeStatus = options.exchange;
  283. this.exchange = options;
  284. }
  285. this.loadData(options.id);
  286. let lastId = wx.getStorageSync("current")
  287. if(lastId){
  288. if(lastId != options.id){
  289. wx.removeStorageSync("contrast")
  290. wx.setStorageSync("current",options.id)
  291. }
  292. }else{
  293. wx.setStorageSync("current",options.id)
  294. }
  295. },
  296. onShareAppMessage(object) {
  297. if (object.from === 'button' && this.shareData) {
  298. return this.$shareAppMessage(this.shareData);
  299. }
  300. return this.$shareAppMessage({
  301. title: this.app_share_title ? this.app_share_title : this.name,
  302. imageUrl: this.app_share_pic ? this.app_share_pic : '',
  303. path: '/pages/goods/goods',
  304. params: {
  305. id: this.goodsId
  306. }
  307. });
  308. },
  309. // #ifdef MP-WEIXIN
  310. onShareTimeline() {
  311. // 分享朋友圈beta
  312. return this.$shareTimeline({
  313. title: this.app_share_title ? this.app_share_title : this.name,
  314. query: {
  315. id: this.goodsId
  316. }
  317. });
  318. },
  319. // #endif
  320. methods: {
  321. goBuy(id,data){
  322. //判断登陆
  323. uni.navigateTo({
  324. url: `/pages/goods/goods?id=${id}`
  325. });
  326. },
  327. cancel(id,index){
  328. console.log(id,index)
  329. if(index){
  330. let contrast = wx.getStorageSync("contrast")
  331. console.log(contrast)
  332. let len = contrast.indexOf(id)
  333. console.log(len)
  334. if(len>=0){
  335. contrast.splice(len,1)
  336. console.log(contrast)
  337. if(contrast.length==0){
  338. console.log(342)
  339. wx.removeStorageSync("contrast")
  340. }else{
  341. wx.setStorageSync("contrast",contrast)
  342. }
  343. this.getCurrentData()
  344. }
  345. }
  346. },
  347. addContrast(id){
  348. let current = wx.getStorageSync("current")
  349. let contrast = wx.getStorageSync("contrast")
  350. if(current != id){
  351. if(!contrast){
  352. contrast = []
  353. }
  354. contrast.push(id)
  355. wx.setStorageSync("contrast",contrast)
  356. this.show_catList = false
  357. this.show_cat = false
  358. this.player_search = ''
  359. console.log(363)
  360. console.log(contrast)
  361. this.getCurrentData()
  362. }
  363. },
  364. hidden_cat(){
  365. this.show_cat = false
  366. this.player_search = ''
  367. },
  368. getShop(id){
  369. let keyword = this.player_search
  370. let params
  371. let url
  372. if(id){
  373. url = this.catApi
  374. params = {
  375. cat_id: id
  376. }
  377. }else{
  378. url = this.searchApi
  379. params = {
  380. keyword: keyword
  381. }
  382. }
  383. console.log(387)
  384. console.log(params)
  385. let resUrl = this.catApi
  386. this.$request({
  387. url: url,
  388. data: params
  389. }).then(response => {
  390. this.$hideLoading();
  391. if (response.code === 0) {
  392. this.cat_list_one = response.data.list
  393. this.show_cat = true
  394. this.show_catList = false
  395. }
  396. })
  397. },
  398. hidden_catList(){
  399. this.show_catList = false
  400. this.player_search = ''
  401. },
  402. getShopList(){
  403. let resUrl = this.catListApi
  404. this.$request({
  405. url: this.catListApi,
  406. data: {
  407. cat_id: this.cat_id
  408. }
  409. }).then(response => {
  410. this.$hideLoading();
  411. console.log(412)
  412. if (response.code === 0) {
  413. this.cat_list = response.data.list
  414. this.show_catList = true
  415. }
  416. })
  417. },
  418. getCurrentData(){
  419. let query = this.goodsId
  420. let contrast = wx.getStorageSync("contrast")
  421. console.log(427)
  422. console.log(contrast)
  423. if(contrast){
  424. console.log(430,this.goodsId)
  425. query = this.goodsId + ',' + contrast.join(',')
  426. }
  427. let resUrl = this.contrastApi
  428. console.log(433)
  429. console.log('query:',query)
  430. this.$request({
  431. url: this.contrastApi,
  432. data: {
  433. goods_id: query
  434. }
  435. }).then(response => {
  436. this.$hideLoading();
  437. if (response.code === 0) {
  438. //当前商品类型id
  439. if(response.data.length>=0&&response.data[0].cat_id){
  440. this.cat_id = response.data[0].cat_id
  441. }
  442. this.formatData(response.data)
  443. }
  444. })
  445. },
  446. formatData(data){
  447. let _this = this
  448. let list = []
  449. let info = []
  450. //商品信息
  451. data.forEach((items,indexs)=>{
  452. let obj = {}
  453. obj.cover_pic = items.goods.cover_pic
  454. obj.id = items.goods.id
  455. obj.name = items.goods.name
  456. obj.price = items.goods.price
  457. info.push(obj)
  458. })
  459. //参数信息
  460. data.forEach((items,indexs)=>{
  461. if(indexs==0){
  462. data[indexs].params.forEach((item,index)=>{
  463. let line = []
  464. data[indexs].params[index].params.forEach((ite,inde)=>{
  465. let text = []
  466. let title = ''
  467. text.push(data[indexs].params[index].params[inde].name)
  468. text.push(data[indexs].params[index].params[inde].value)
  469. data.forEach((it,i)=>{
  470. if(i!=0){
  471. if(data[i].params.length>0)
  472. text.push(data[i].params[index].params[inde].value||'')
  473. }
  474. })
  475. title = data[indexs].params[index].name
  476. line.push({
  477. title:title,
  478. text:text
  479. })
  480. })
  481. list.push(line)
  482. })
  483. }
  484. })
  485. this.contrastList = {}
  486. this.contrastList.list = list
  487. this.contrastList.info = info
  488. },
  489. getMall(e) {
  490. this.is_open = e.is_open;
  491. },
  492. toExchange() {
  493. let mch_list = [{
  494. mch_id: 0,
  495. goods_list: [{
  496. id: this.exchange.id,
  497. attr: this.exchange.attr,
  498. num: this.exchange.goods_num,
  499. cat_id: 0,
  500. goods_attr_id: this.exchange.attr_id
  501. }],
  502. code: this.exchange.code,
  503. token: this.exchange.token,
  504. }];
  505. let url = `/pages/order-submit/order-submit?mch_list=${JSON.stringify(mch_list)}`;
  506. url += `&preview_url=${encodeURIComponent(this.$api.exchange.exchange_preview)}&submit_url=${encodeURIComponent(this.$api.exchange.exchange_submit)}&plugin=exchange`;
  507. uni.navigateTo({
  508. url: url
  509. })
  510. },
  511. // 规格选择
  512. check(obj) {
  513. this.checked = obj;
  514. },
  515. change(e) {
  516. if(e.detail.source === 'touch') {
  517. this.current = e.detail.current;
  518. }
  519. if(e.detail.source === 'autoplay') {
  520. this.current = e.detail.current;
  521. }
  522. },
  523. quickShare(info) {
  524. this.shareData = info;
  525. },
  526. toComposition(item) {
  527. let id = item.id > 0 ? item.id : this.composition.list[0].id
  528. uni.navigateTo({
  529. url: this.composition.url + '?goods_id=' + this.goodsId + '&composition_id=' + id
  530. })
  531. },
  532. loadData(id) {
  533. this.$showLoading();
  534. this.$request({
  535. url: this.$api.goods.detail,
  536. data: {
  537. id: id
  538. }
  539. }).then(response => {
  540. this.$hideLoading();
  541. if (response.code === 0) {
  542. let { services,
  543. detail, name,
  544. vip_card_appoint, plugin_extra, id,
  545. goods_activity, goods_marketing_award,
  546. goods_marketing, express,
  547. price, sales,
  548. level_show, is_sales, unit, extra_quick_share,
  549. price_max, price_min, price_member_max,
  550. price_member_min, original_price, subtitle,
  551. is_negotiable, app_share_title,
  552. app_share_pic, type, favorite, goods_coupon_center,
  553. guarantee_title, guarantee_pic, param_content,
  554. param_name, attr_groups, goods_num, good_stock
  555. } = response.data.goods;
  556. uni.setNavigationBarTitle({
  557. title: name
  558. });
  559. this.name = name;
  560. this.app_share_pic = app_share_pic;
  561. this.app_share_title = app_share_title;
  562. this.goods = response.data.goods;
  563. this.services = services;
  564. this.detail = detail;
  565. this.goodsId = id;
  566. this.flash_sale = plugin_extra.flash_sale;
  567. this.composition = plugin_extra.composition;
  568. this.goods_marketing_award = goods_marketing_award;
  569. this.goods_marketing = goods_marketing;
  570. this.express = express;
  571. this.price = price;
  572. this.level_show = level_show;
  573. this.sales = sales;
  574. this.unit = unit;
  575. this.is_sales = is_sales;
  576. this.price_max = price_max;
  577. this.price_min = price_min;
  578. this.price_member_max = price_member_max;
  579. this.price_member_min = price_member_min;
  580. this.original_price = original_price;
  581. this.subtitle = subtitle;
  582. this.is_negotiable = is_negotiable;
  583. this.extra_quick_share = extra_quick_share;
  584. this.goodsType = type;
  585. this.favorite = favorite;
  586. this.goods_coupon_center = goods_coupon_center;
  587. this.guarantee_title = guarantee_title;
  588. this.param_content = param_content;
  589. this.guarantee_pic = guarantee_pic;
  590. this.attr_groups = attr_groups;
  591. this.param_name = param_name;
  592. this.goods_num = goods_num;
  593. this.good_stock = good_stock;
  594. if (goods_activity) {
  595. this.full_reduce = goods_activity.full_reduce;
  596. }
  597. if(vip_card_appoint.discount || vip_card_appoint.discount === '0.00') {
  598. this.is_vip = true;
  599. this.discount = vip_card_appoint.discount
  600. }
  601. this.is_vip_card_user = vip_card_appoint.is_vip_card_user;
  602. this.loadRecommend();
  603. //
  604. this.getCurrentData()
  605. } else {
  606. uni.showToast({
  607. title: response.msg,
  608. icon: 'none'
  609. });
  610. }
  611. }).catch(() => {
  612. this.$hideLoading();
  613. });
  614. },
  615. onAttr(data) {
  616. this.selectAttr = data;
  617. },
  618. loadRecommend() {
  619. this.$request({
  620. url: this.$api.goods.new_recommend,
  621. data: {
  622. goods_id: this.goodsId,
  623. type: 'goods'
  624. }
  625. }).then(response => {
  626. if (response.code === 0) {
  627. this.recommend_list = response.data.list;
  628. }
  629. });
  630. },
  631. back() {
  632. uni.reLaunch({
  633. url: '/pages/index/index'
  634. });
  635. },
  636. setFavorite() {
  637. let url = this.$api.user.favorite_add;
  638. let favorite = true;
  639. if (this.favorite) {
  640. url = this.$api.user.favorite_remove;
  641. favorite = false;
  642. }
  643. this.favorite = favorite;
  644. this.$request({
  645. url: url,
  646. data: {
  647. goods_id: this.goodsId
  648. }
  649. }).then(response => {
  650. if (response.code === 0) {
  651. } else {
  652. uni.showModal({
  653. title: '提示',
  654. content: response.msg,
  655. showCancel: false
  656. });
  657. }
  658. });
  659. },
  660. clickAttr(data) {
  661. if (this.goods.type === 'ecard' && data === 0) {
  662. uni.showToast({
  663. title: '虚拟商品不允许加入购物车',
  664. icon: 'none'
  665. });
  666. return;
  667. }
  668. this.attrShow = true;
  669. },
  670. setCoupon(index) {
  671. this.$set(this.goods_coupon_center[index], 'is_receive', 1);
  672. }
  673. },
  674. onShow() {
  675. this.autoplay = true;
  676. this.showClose = false;
  677. setTimeout(()=>{
  678. this.showClose = true;
  679. })
  680. },
  681. onHidden() {
  682. this.autoplay = false;
  683. }
  684. }
  685. </script>
  686. <style scoped lang="scss">
  687. .player{
  688. background:rgba(0,0,0,0.4);position:fixed;left:0;top:0;width:100%;height:100%;
  689. text-align:center;z-index:100;
  690. .player-content{
  691. position:absolute;left:50%;top:40%;transform:translate(-50%,-50%);
  692. width:80%;background: #fff;
  693. .player-title{
  694. width: 100%;
  695. height: 45px;
  696. border-bottom: 1px solid #dfdfdf;
  697. background: #fcfcfc;
  698. line-height: 44px;
  699. text-align: center;
  700. font-size: 16px;
  701. }
  702. .player-search{
  703. width: 100%;line-height: 44px;text-align: center;
  704. font-size: 16px;height: 45px;border-bottom: 1px solid #dfdfdf;
  705. display:flex;justify-content: space-around;
  706. .input{
  707. width:72%;display:inline-block;
  708. input{text-align:left;padding-left:10px;
  709. outline:none;border:none;background:none;width:100%;margin-top:7px;display:block;height:30px;border-radius:20px;border:1px solid #ccc;
  710. }
  711. }
  712. .btn{
  713. display:inline-block;line-height:44px;
  714. margin-right:4%;
  715. }
  716. }
  717. .player-list{
  718. max-height:320px;
  719. overflow:scroll;
  720. .player-item{
  721. margin:0px 10px;
  722. height: 40px;
  723. line-height: 40px;
  724. border-bottom: 1px solid #e3e3e3;
  725. box-sizing: border-box;
  726. padding: 0px 10px;
  727. color: #45a1de;
  728. text-align:left;
  729. display:flex;
  730. .player-left{
  731. min-width:60px;
  732. width:60px;
  733. max-width:60px;
  734. height:60px;
  735. margin:10px 10px 10px 0;
  736. flex-shink:0;
  737. flex-grow:0;
  738. image{
  739. width:100%;
  740. height:100%;
  741. }
  742. }
  743. .player-right{
  744. margin:10px 0;
  745. flex-grow: 1;
  746. height:60px;
  747. .player-name{
  748. font-size:14px;font-weight:700;
  749. margin-bottom:4px;color:#333;
  750. display: -webkit-box;
  751. -webkit-box-orient: vertical;
  752. -webkit-line-clamp: 2;
  753. overflow: hidden;
  754. }
  755. .player-price{
  756. font-size:12px;
  757. line-height:14px;
  758. color:#f21c1c;
  759. }
  760. }
  761. }
  762. }
  763. .player-close{
  764. color: #45a1de;
  765. padding:10px;
  766. cursor:pointer;
  767. }
  768. }
  769. }
  770. .player-one .player-content .player-list .player-item{height:80px;line-height:18px;}
  771. .contrast{position:relative;}
  772. .title{position:fixed;left:0;top:0;width:100%;background:#ececec;text-align:center;color:red;font-size:14px;line-height:36px;height:36px;}
  773. .colmun{
  774. width:772px;
  775. padding-bottom:40px;
  776. padding-top:36px;
  777. overflow:hidden;
  778. text-align:center;
  779. border:1px solid rgb(239, 242, 245);
  780. .list{
  781. .contrast_title {
  782. line-height:38px;height:40px;box-sizing:border-box;text-align:left;padding:0 8px;font-weight:600;
  783. font-size:12px;color:#f21c1c;background:rgb(239, 242, 245);border:1px solid rgb(239, 242, 245);
  784. }
  785. .contrast_item {
  786. display:flex;
  787. border:1px solid rgb(239, 242, 245);
  788. .contrast_key{
  789. font-size:12px;
  790. width:80px;
  791. height:auto;
  792. box-sizing:border-box;
  793. text-align:center;
  794. padding:10px 8px;
  795. line-height:20px;
  796. min-height:40px;
  797. border:1px solid rgb(239, 242, 245);
  798. display:flex;
  799. text-align:center;
  800. align-items: center;
  801. overflow:hidden;
  802. flex-wrap: wrap;
  803. .pic{
  804. width:100%;height:100px;
  805. text-align:center;
  806. float:left;
  807. image{
  808. width:100px;
  809. height:100px;
  810. }
  811. }
  812. .name{
  813. margin-top:10px;
  814. width:100%;
  815. float:left;
  816. font-size:12px;
  817. line-height: 14px;
  818. max-height: 28px;
  819. height:28px;
  820. overflow: hidden;
  821. }
  822. .price{
  823. width:100%;
  824. float:left;
  825. color:#f21c1c;
  826. font-size:12px;
  827. }
  828. .buy{
  829. display: block;
  830. width: 90px;
  831. height: 30px;
  832. text-align: center;
  833. line-height: 30px;
  834. border-radius: 3px;
  835. margin: 5px auto 8px;
  836. color:#fff;
  837. background:#f21c1c;
  838. }
  839. .cancel{
  840. width:100%;
  841. float:left;
  842. color: #3caaff;
  843. }
  844. .unable{
  845. color:#aaa;
  846. }
  847. }
  848. .contrast_key2,.contrast_key3,.contrast_key4,.contrast_key5{justify-content: space-around;width:173px;text-align:center;}
  849. }
  850. }
  851. }
  852. </style>