Commit 20b514cb25d859d69d8a099781605a1961e8f697

Authored by 后端研发-苏泰源
1 parent 36a7c2ff

商品详情页保障服务优化

packageA/pages/goodsInfo/goodsInfo.js
... ... @@ -451,6 +451,24 @@ Page({
451 451  
452 452 },
453 453  
  454 +
  455 + onReady() {
  456 +
  457 + setTimeout(()=>{
  458 + wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
  459 + // console.log('node@@@@@@@', res);
  460 + if(res.length != 0) {
  461 + this.setData({
  462 + showFold: res[0].height < res[1].height,
  463 + });
  464 + };
  465 +
  466 + }).exec();
  467 + }, 1000);
  468 +
  469 + },
  470 +
  471 +
454 472 //------------程序初始化入口-------------
455 473 async init(gid) {
456 474 var ee = this,
... ...
packageA/pages/goodsInfo/goodsInfo.wxml
... ... @@ -187,18 +187,19 @@
187 187 </view>
188 188  
189 189  
190   -
191   - <view class="bz_view flex bdt16" wx:if="{{store_config}}">
  190 + <!-- 保障服务 -->
  191 + <view class="bz_view flex bdt16 ai_c" wx:if="{{store_config}}">
192 192 <image class="bzfu_img" src="{{iurl}}/miniapp/images/bzfu_w.png"></image>
193   - <view class="flex f1 ai_c rel">
194   - <view class="bz-content {{flag ? '':'ellipsis-1'}} f1">{{store_config.service_bz}}</view>
195   - <view bindtap="clickCollapse" class="cx-obtain-coupon wsize arrow">
196   - <text class="bg_jj {{flag?'down1':''}}"></text>
197   - </view>
198   - <!-- <text class="bg_jj" bindtap="clickCollapse"></text> -->
199   - <!-- <text class="iconfont icon-shuangjiantouxia c-db"></text> -->
  193 + <view class="flex f1 ai_c rel" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">
  194 + <view class="bz-content showArea {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view>
  195 + <view class="bz-content hideArea">{{bconfig.service_bz}}</view>
  196 + <view class="cx-obtain-coupon wsize arrow" wx:if="{{showFold}}">
  197 + <text class="bg_jj down {{flag ? 'up':''}}"></text>
  198 + </view>
200 199 </view>
201 200 </view>
  201 +
  202 +
202 203  
203 204  
204 205  
... ...
packageA/pages/goodsInfo/goodsInfo.wxss
... ... @@ -1025,25 +1025,37 @@ left:31rpx;}
1025 1025 .bz_view{ /* height:100rpx; padding: 0 34rpx 0 13rpx; */ color: #333; font-size: 28rpx; padding: 20rpx 20rpx 20rpx 10rpx;
1026 1026 /* border-bottom: 3rpx solid #eee; */
1027 1027 /* border-top: 3rpx solid #eee; */}
1028   - .bz_view view{ width: 460rpx; /* max-height: 70rpx; */ /* overflow: hidden; */}
  1028 + .bz_view view{ width: 520rpx; /* max-height: 70rpx; */ /* overflow: hidden; */}
1029 1029  
1030 1030 .bb_view{ display: flex;align-items: center;justify-content: space-between; padding: 20rpx; color: #333;
1031 1031 font-size: 30rpx; /* height: 104rpx; line-height: 104rpx; overflow: hidden; padding-right:26rpx */ }
1032 1032 .red_bb{ color: #d70026; /* min-width:158rpx;width: auto; */}
1033   -.bg_jj{ width: 14rpx; height:14rpx;
1034   - border-top: 2rpx solid #d70026;
1035   - border-right: 2rpx solid #d70026;
1036   - transform: rotate(45deg);display:inline-block;
1037   - margin-bottom:3rpx;
  1033 +
  1034 +.bg_jj {
  1035 + width: 14rpx;
  1036 + height: 14rpx;
  1037 + border-top: 2rpx solid #d70026;
  1038 + border-right: 2rpx solid #d70026;
  1039 + transform: rotateZ(45deg);
  1040 + display: inline-block;
  1041 + margin-bottom: 3rpx;
  1042 +}
  1043 +
  1044 +.bg_jj.down {
  1045 + transform: rotateZ(135deg);
  1046 +}
  1047 +
  1048 +.bg_jj.up {
  1049 + transform: rotateZ(-45deg);
  1050 + margin-top: 6rpx;
1038 1051 }
1039   -.bg_jj.down1{transform: rotate(135deg);}
1040 1052  
1041 1053 .bz-content {
1042   - flex-grow: 1;
1043   - text-align: justify;
1044   - padding: 0 30rpx 0 20rpx;
  1054 + padding: 0 0 0 20rpx;
1045 1055 }
1046 1056  
  1057 +
  1058 +
1047 1059 /* 顶部边框 */
1048 1060 .topframe{
1049 1061 width: 100%;
... ... @@ -2845,7 +2857,8 @@ button.custom-service::after{
2845 2857 width: auto !important;
2846 2858 position: absolute;
2847 2859 right: 0;
2848   - top: 10rpx;
  2860 + top: 50%;
  2861 + transform: translateY(-50%);
2849 2862 }
2850 2863  
2851 2864 .stock {
... ... @@ -2949,3 +2962,9 @@ button.custom-service::after{
2949 2962 .huise {
2950 2963 background: gray
2951 2964 }
  2965 +
  2966 +.hideArea {
  2967 + position: absolute;
  2968 + left: -1000px;
  2969 + top: -1000px;
  2970 +}
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -8,6 +8,9 @@ var t = require(&quot;../../../utils/util.js&quot;),
8 8 oo = s.globalData,
9 9 o = s.globalData.setting,
10 10 os = o;
  11 +
  12 +let self = null;
  13 +
11 14 //评价加载更多
12 15 var more = function (e) {
13 16 return e && e.__esModule ? e : {
... ... @@ -25,7 +28,7 @@ Page({
25 28 color_type: 0, //线条控制
26 29 color_type_one: 0,
27 30 color_type_two: 1,
28   - is_no_plus:1,
  31 +
29 32 gid: "",
30 33 stoid: o.stoid,
31 34 url: o.url,
... ... @@ -251,13 +254,11 @@ Page({
251 254  
252 255 share_hidden: false,
253 256 all_activity_list: null, //所有活动的列表
  257 +
254 258 },
255 259  
256 260 //------初始化加载----------
257 261 onLoad: function (t) {
258   - if(!getApp().is_Single_page()){
259   - return false;
260   - }
261 262 var ee = this,
262 263 that = ee,
263 264 th = ee,
... ... @@ -268,7 +269,8 @@ Page({
268 269 prom_type = t.prom_type,
269 270 prom_id = t.prom_id; //活动ID
270 271  
271   -
  272 + self = this;
  273 +
272 274 //-- 自定义海报 --
273 275 getApp().request.promiseGet("/api/weshop/goods/poster/page", {
274 276 data: {store_id: os.stoid, type: 1, is_use: 1}
... ... @@ -357,22 +359,6 @@ Page({
357 359 th.data.c_guide_id = c_guide_id;
358 360 }
359 361  
360   - //调用接口判断商家plus有没有过期
361   - i.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => {
362   - if (res.data.code == 0) {
363   - var arr = res.data.data.pageData;
364   - if (arr.length > 0) {
365   - var item = arr[0];
366   - if (item.is_sy == 0) {
367   - var now = Date.parse(new Date()); now = now / 1000;
368   - if (item.end_time < now) {
369   - th.setData({ is_no_plus: 0 })
370   - }
371   - }
372   - }
373   - }
374   - })
375   -
376 362 getApp().getConfig(function (e) {
377 363 ee.setData({sto_sele_name_1: e.store_name})
378 364 })
... ... @@ -530,7 +516,9 @@ Page({
530 516 //更新点击量
531 517 getApp().request.put("/api/weshop/goods/updateClick", {
532 518 data: {store_id: os.stoid, goods_id: gid}
533   - })
  519 + });
  520 +
  521 +
534 522 },
535 523  
536 524  
... ... @@ -982,8 +970,27 @@ Page({
982 970 })
983 971  
984 972 this.data.enterAddressPage && (this.data.enterAddressPage = !1);
985   -
986   - },
  973 +
  974 +
  975 +
  976 + },
  977 +
  978 + onReady() {
  979 +
  980 + setTimeout(()=>{
  981 + wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
  982 + // console.log('node@@@@@@@', res);
  983 + if(res.length != 0) {
  984 + this.setData({
  985 + showFold: res[0].height < res[1].height,
  986 + });
  987 + };
  988 +
  989 + }).exec();
  990 + }, 1000);
  991 +
  992 + },
  993 +
987 994 enterAddress: function () {
988 995 this.data.enterAddressPage = !0, wx.navigateTo({
989 996 url: "/pages/user/address_list/address_list?operate=selectAddress"
... ... @@ -3545,7 +3552,6 @@ Page({
3545 3552  
3546 3553 //---判断拼单----
3547 3554 if (prom_type == 6) {
3548   - console.log('判断拼单');
3549 3555 //-------判断活动是否抢光---------
3550 3556 await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, {
3551 3557 1: 1
... ... @@ -6541,6 +6547,73 @@ Page({
6541 6547  
6542 6548 closeSpecModal_flash_normal: function () {
6543 6549 this.setData({openSpecModal_flash_normal: 0});
6544   - }
  6550 + },
  6551 +
  6552 +
  6553 +
  6554 +
  6555 +
  6556 + // 获取指定元素实际宽度
  6557 + _getElementWidth(id) {
  6558 + // return new Promise(resolve => {
  6559 + // let _query = wx.createSelectorQuery();
  6560 + // _query.select(id).boundingClientRect(function(res) {
  6561 + // console.log('实际宽度~~~~~', res);
  6562 + // }).exec();
  6563 +
  6564 + // const query = wx.createSelectorQuery().in(this)
  6565 + // query.select('#toggle-content').boundingClientRect(function(res){
  6566 + // //res.top // 这个组件内 #the-id 节点的上边界坐标
  6567 + // // console.log('jfidsjfiojsdifjoisdjfiosdf', res);
  6568 + // }).exec()
  6569 + },
  6570 +
  6571 + // 说明文字收起/隐藏事件
  6572 + toggleHandler() {
  6573 + const {toggleFlag} = this.data.toggleParams;
  6574 +
  6575 + this.setData({
  6576 + toggleParams: {
  6577 + toggleFlag: toggleFlag === 0 ? 1 : 0,
  6578 + toggleShow: true
  6579 + }
  6580 + })
  6581 + },
  6582 + /*
  6583 + * 检测说明文字是否须要隐藏/收起操做
  6584 + * 对比文字外层固定宽度容器元素宽度wrapperWidth与当前文字元素宽度contentWidth
  6585 + * 若相差小于10则说明超出一行
  6586 + * */
  6587 + _checkRemarkToggle() {
  6588 + var self = this;
  6589 + // setTimeout(function() {
  6590 + // self._getElementWidth('#toggle-content');
  6591 + // }, 1000);
  6592 +
  6593 + // Promise.all([
  6594 + // this._getElementWidth('#toggle-wrapper'),
  6595 + // this._getElementWidth('#toggle-content')]
  6596 + // ).then(res => {
  6597 + // const wrapperWidth = res[0];
  6598 + // const contentWidth = res[1];
  6599 +
  6600 + // // const {limitRemark, startDate, endDate, statusCode} = this.properties.couponData;
  6601 +
  6602 + // if (wrapperWidth - contentWidth < 10) {
  6603 + // this.setData({
  6604 + // // toggleParams: {
  6605 + // // toggleFlag: 1,
  6606 + // // toggleShow: true
  6607 + // // },
  6608 + // // timeArea: `${startDate}-${endDate}`,
  6609 + // // unableImageSrc: UNABLE_IMAGE[statusCode]
  6610 + // })
  6611 + // }
  6612 + // })
  6613 + }
  6614 +
  6615 +
  6616 +
  6617 +
6545 6618  
6546 6619 })
... ...
pages/goods/goodsInfo/goodsInfo.wxml
... ... @@ -324,7 +324,7 @@
324 324 </view>
325 325 <!-- 不是秒杀 -->
326 326 <!-- 等级卡的价格,不是等级卡会员,且商品又有设置等级级价,商家后台有开通升级卡同能 -->
327   - <view class="flex ai_and" wx:if="{{!card_field && is_no_plus && g_filters.is_has_rank(rank_switch,data) && prom_type!=1 && prom_type!=2 && prom_type!=4 && card_list && card_list.length>0 && g_filters.get_card_price(data,card_list,1)!=''}}">
  327 + <view class="flex ai_and" wx:if="{{!card_field && g_filters.is_has_rank(rank_switch,data) && prom_type!=1 && prom_type!=2 && prom_type!=4 && card_list && card_list.length>0 && g_filters.get_card_price(data,card_list,1)!=''}}">
328 328 <view class="flex ai-center grade-card-frame card-frame">
329 329 <image class="img" src="{{iurl}}/miniapp/images/userinfo/userinfo/privilege_t.png"></image>
330 330 <view class="fs24 white view card-name ellipsis-1">
... ... @@ -336,7 +336,7 @@
336 336 </view>
337 337 </view>
338 338 <!-- 等级卡的显示,购买, 等级卡近30天要显示续费 -->
339   - <block wx:if="{{g_filters.is_has_rank(rank_switch,data) && is_no_plus}}">
  339 + <block wx:if="{{g_filters.is_has_rank(rank_switch,data)}}">
340 340 <!-- 不是秒杀,且会员不是等级会员 -->
341 341 <view wx:if="{{!card_field && prom_type!=1 && prom_type!=2 && card_list && card_list.length>0 && g_filters.get_card_price(data,card_list,1)!=''}}">
342 342 <view class="beauty-makeup-frame flex ai-center">
... ... @@ -662,15 +662,17 @@
662 662 </block>
663 663  
664 664 <!-- 保障服务 -->
665   - <view class="bz_view flex bdt16" wx:if="{{bconfig}}" style="">
  665 + <view class="bz_view flex bdt16 ai_c" wx:if="{{bconfig.service_bz}}">
666 666 <image class="bzfu_img" src="{{iurl}}/miniapp/images/bzfu_w.png"></image>
667   - <view class="flex f1 ai_c rel">
668   - <view class="bz-content {{flag ? '':'ellipsis-1'}} f1">{{bconfig.service_bz}}</view>
669   - <view bindtap="clickCollapse" class="cx-obtain-coupon wsize arrow">
670   - <text class="bg_jj {{flag?'down1':''}}"></text>
  667 + <view class="flex f1 ai_c rel" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">
  668 + <view class="bz-content showArea {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view>
  669 + <view class="bz-content hideArea">{{bconfig.service_bz}}</view>
  670 + <view class="cx-obtain-coupon wsize arrow" wx:if="{{showFold}}">
  671 + <text class="bg_jj down {{flag ? 'up':''}}"></text>
671 672 </view>
672 673 </view>
673 674 </view>
  675 +
674 676 <!-- - 搭配促销 -- -->
675 677 <view class="dp_cx_view" wx:if="{{collocationGoods}}">
676 678 <view class="bb_view">
... ...
pages/goods/goodsInfo/goodsInfo.wxss
... ... @@ -1582,7 +1582,7 @@ view.cart-btn-lg {
1582 1582 }
1583 1583  
1584 1584 .bz_view view {
1585   - width: 460rpx;
  1585 + width: 520rpx;
1586 1586 /* max-height: 70rpx; */
1587 1587 /* overflow: hidden; */
1588 1588 }
... ... @@ -1607,21 +1607,27 @@ view.cart-btn-lg {
1607 1607 height: 14rpx;
1608 1608 border-top: 2rpx solid #d70026;
1609 1609 border-right: 2rpx solid #d70026;
1610   - transform: rotate(45deg);
  1610 + transform: rotateZ(45deg);
1611 1611 display: inline-block;
1612 1612 margin-bottom: 3rpx;
1613 1613 }
1614 1614  
1615   -.bg_jj.down1 {
1616   - transform: rotate(135deg);
  1615 +.bg_jj.down {
  1616 + transform: rotateZ(135deg);
  1617 +}
  1618 +
  1619 +.bg_jj.up {
  1620 + transform: rotateZ(-45deg);
  1621 + margin-top: 6rpx;
1617 1622 }
1618 1623  
1619 1624 .bz-content {
1620   - flex-grow: 1;
1621   - text-align: justify;
1622   - padding: 0 30rpx 0 20rpx;
  1625 + padding: 0 0 0 20rpx;
1623 1626 }
1624 1627  
  1628 +
  1629 +
  1630 +
1625 1631 /* 顶部边框 */
1626 1632 .topframe {
1627 1633 width: 100%;
... ... @@ -3774,7 +3780,8 @@ button.custom-service::after {
3774 3780 width: auto !important;
3775 3781 position: absolute;
3776 3782 right: 0;
3777   - top: 10rpx;
  3783 + top: 50%;
  3784 + transform: translateY(-50%);
3778 3785 }
3779 3786  
3780 3787  
... ... @@ -3935,3 +3942,9 @@ button.custom-service::after {
3935 3942 width: 100%;
3936 3943 height: 100%;
3937 3944 }
  3945 +
  3946 +.hideArea {
  3947 + position: absolute;
  3948 + left: -1000px;
  3949 + top: -1000px;
  3950 +}
... ...