Commit 7ce4dd6c55386ae511b3fa5e472d4d6c4c24cc3c

Authored by 前端开发-罗建龙
1 parent 97a6dfb8

OA单测试返回问题优化

packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... ... @@ -317,6 +317,39 @@ Page({
317 317 //检查测肤
318 318 getApp().check_skin_face(t,0,gid);
319 319  
  320 + //-- 自定义海报 --
  321 + getApp().request.promiseGet("/api/weshop/goods/poster/page", {
  322 + data: {store_id: os.stoid, type: 1, is_use: 1}
  323 + }).then(res => {
  324 + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData[0]) {
  325 +
  326 + var poster_data = res.data.data.pageData[0];
  327 + var json_str = poster_data.jsonStr;
  328 +
  329 + if (json_str) {
  330 + var json_data = JSON.parse(json_str);
  331 + console.log('自定义海报参数-------');
  332 + console.log(json_data);
  333 + if (json_data.bg_img) {
  334 +
  335 + //-- 把图片那到本地 --
  336 + wx.getImageInfo({
  337 + src: json_data.bg_img,
  338 + success: function (res) {
  339 + var path = res.path;
  340 +
  341 + th.setData({share_b_img: path})
  342 + },
  343 + fail: function (res) {
  344 + }
  345 + });
  346 + }
  347 + th.setData({poster: json_data})
  348 +
  349 + }
  350 + }
  351 + })
  352 +
320 353 //---获取手机地址坐标--
321 354 //--如果tg_id是空的话,分享回来--
322 355 // console.log('扫描海报gid');
... ... @@ -4648,7 +4681,7 @@ Page({
4648 4681 // 8.商品标题
4649 4682 context.setFontSize(20 * unit);
4650 4683 context.setFillStyle('#898989');
4651   - this.draw_Text(context, this.data.data.goods_name,
  4684 + getApp().draw_Text(context, this.data.data.goods_name,
4652 4685 54 * unit, 770 * unit, 240 * unit, 240 * unit, unit);
4653 4686 // 9.小程序码
4654 4687 context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit);
... ... @@ -4745,7 +4778,7 @@ Page({
4745 4778 // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
4746 4779  
4747 4780  
4748   - if (type == 0) { // 如果是普通商品,绘制新海报
  4781 + if (!th.data.share_b_img && (type == 9)) { // 如果是普通商品,绘制新海报
4749 4782 th.drawPoster(context, unit, th.data.share_goods_img, vpath);
4750 4783 } else {
4751 4784 context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
... ... @@ -4755,7 +4788,7 @@ Page({
4755 4788  
4756 4789  
4757 4790 //-- 是自定义海报的情况下 --
4758   - if (type != 0) {
  4791 + if (th.data.share_b_img || type != 0) {
4759 4792  
4760 4793  
4761 4794  
... ... @@ -4786,10 +4819,10 @@ Page({
4786 4819 }
4787 4820 } else {
4788 4821 //--昵称---
4789   - context.setFontSize(24 * unit);
4790   - context.setFillStyle("black");
4791   - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit);
4792   - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
  4822 + // context.setFontSize(24 * unit);
  4823 + // context.setFillStyle("black");
  4824 + // context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit);
  4825 + // var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
4793 4826 //强烈推荐 改许程
4794 4827 // var tj_path = "../../../../images/share/q_tj.png";
4795 4828 // let txt_gn = th.data.luckGoInfo.group_num + '人团';
... ... @@ -4800,9 +4833,9 @@ Page({
4800 4833 // context.setFillStyle("white");
4801 4834 // context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit);
4802 4835 // 发出幸运购活动邀请
4803   - context.setFillStyle("#7f7f7f")
4804   - context.setFontSize(21.3 * unit)
4805   - context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit);
  4836 + // context.setFillStyle("#7f7f7f")
  4837 + // context.setFontSize(21.3 * unit)
  4838 + // context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit);
4806 4839  
4807 4840 }
4808 4841  
... ... @@ -4819,7 +4852,7 @@ Page({
4819 4852  
4820 4853 //---产品名称---
4821 4854 //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
4822   - if (type != 4 && type != 0) {
  4855 + if (th.data.share_b_img || (type != 4 && type != 9)) {
4823 4856 context.setFillStyle("black");
4824 4857 context.setFontSize(21.3 * unit)
4825 4858 th.draw_Text(context, share_title,
... ... @@ -4880,11 +4913,29 @@ Page({
4880 4913 }
4881 4914  
4882 4915 //---中间大图---
4883   - if (type != 0) {
  4916 + if ( th.data.share_b_img || type != 9) {
4884 4917 context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
4885 4918 };
4886 4919  
  4920 + //---自定义海报 产品质量保证
  4921 + if(th.data.share_b_img && th.data.poster.show_quality==1 ){
  4922 + var g_path = "../../../../images/share/s_gou.png";
  4923 + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
  4924 + context.setFillStyle("red")
  4925 + context.setFontSize(18 * unit)
  4926 + context.fillText("正品保证", 84 * unit, 690 * unit);
4887 4927  
  4928 + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
  4929 + context.setFillStyle("red")
  4930 + context.setFontSize(18 * unit)
  4931 + context.fillText("纯实体店", 246 * unit, 690 * unit);
  4932 +
  4933 + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
  4934 + context.setFillStyle("red")
  4935 + context.setFontSize(18 * unit)
  4936 + context.fillText("官方验证", 420 * unit, 690 * unit);
  4937 +
  4938 + }
4888 4939  
4889 4940 //-------大图后面就不一样了-----------
4890 4941 switch (type) {
... ... @@ -5101,74 +5152,76 @@ Page({
5101 5152  
5102 5153  
5103 5154 case 9:
  5155 + if(th.data.share_b_img){
5104 5156  
5105   - //---画线---
5106   - context.setLineWidth(1 * unit)
5107   - context.moveTo(32 * unit, 680 * unit)
5108   - context.lineTo(520 * unit, 680 * unit)
5109   - context.stroke();
5110   -
5111   - //---文字---
5112   - context.setFillStyle("black")
5113   - context.setFontSize(24 * unit)
5114   - context.font = 'normal bold 18px';
5115   - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
5116   -
5117   - //还差N人,即可成团
5118   - let group_num = th.data.luckGoInfo.group_num;
5119   - let num_joined = th.data.luckGoInfo.num;
5120   - let delta1 = group_num - num_joined;
5121   - let width_delta1 = ut.measureText(delta1, 15);
5122   - context.setFillStyle("black");
5123   - context.setFontSize(21.3 * unit);
5124   - context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit);
5125   - context.setFillStyle("#FF6768");
5126   - context.setFontSize(21.3 * unit);
5127   - context.fillText(delta1, 160 * unit, 772 * unit);
5128   - context.setFillStyle("black");
5129   - context.setFontSize(21.3 * unit);
5130   - context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit);
5131   -
5132   - // N人得商品,N人全额退款
5133   - let group_win = th.data.luckGoInfo.group_win;
5134   - let delta2 = group_num - group_win;
5135   - let width_delta2 = ut.measureText(delta2, 16);
5136   - let width_groupNum = ut.measureText(group_num, 15);
5137   - let width_groupWin = ut.measureText(group_win, 15);
5138   - context.setFillStyle("#FF6768");
5139   - context.setFontSize(21.3 * unit);
5140   - context.fillText(group_win, 40 * unit, 806 * unit);
5141   - context.setFillStyle("black");
5142   - context.setFontSize(21.3 * unit);
5143   - context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit);
5144   - context.setFillStyle("#FF6768");
5145   - context.setFontSize(21.3 * unit);
5146   - context.fillText(delta2, 160 * unit, 806 * unit);
5147   - context.setFillStyle("black");
5148   - context.setFontSize(21.3 * unit);
5149   - context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit);
5150   -
5151   - // 并得帮团惊喜礼品
5152   - context.setFillStyle("black")
5153   - context.setFontSize(21.3 * unit)
5154   - context.fillText("并得帮团", 40 * unit, 840 * unit);
5155   - context.setFillStyle("#FF6768")
5156   - context.setFontSize(21.3 * unit)
5157   - context.fillText("惊喜礼品", 130 * unit, 840 * unit);
5158   - context.setFillStyle("black")
5159   - context.setFontSize(21.3 * unit)
5160   - context.fillText("!", 220 * unit, 840 * unit);
  5157 +
  5158 + //---画线---
  5159 + context.setLineWidth(1 * unit)
  5160 + context.moveTo(32 * unit, 680 * unit)
  5161 + context.lineTo(520 * unit, 680 * unit)
  5162 + context.stroke();
5161 5163  
  5164 + //---文字---
  5165 + context.setFillStyle("black")
  5166 + context.setFontSize(24 * unit)
  5167 + context.font = 'normal bold 18px';
  5168 + context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
  5169 +
  5170 + //还差N人,即可成团
  5171 + let group_num = th.data.luckGoInfo.group_num;
  5172 + let num_joined = th.data.luckGoInfo.num;
  5173 + let delta1 = group_num - num_joined;
  5174 + let width_delta1 = ut.measureText(delta1, 15);
  5175 + context.setFillStyle("black");
  5176 + context.setFontSize(21.3 * unit);
  5177 + context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit);
  5178 + context.setFillStyle("#FF6768");
  5179 + context.setFontSize(21.3 * unit);
  5180 + context.fillText(delta1, 160 * unit, 772 * unit);
  5181 + context.setFillStyle("black");
  5182 + context.setFontSize(21.3 * unit);
  5183 + context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit);
  5184 +
  5185 + // N人得商品,N人全额退款
  5186 + let group_win = th.data.luckGoInfo.group_win;
  5187 + let delta2 = group_num - group_win;
  5188 + let width_delta2 = ut.measureText(delta2, 16);
  5189 + let width_groupNum = ut.measureText(group_num, 15);
  5190 + let width_groupWin = ut.measureText(group_win, 15);
  5191 + context.setFillStyle("#FF6768");
  5192 + context.setFontSize(21.3 * unit);
  5193 + context.fillText(group_win, 40 * unit, 806 * unit);
  5194 + context.setFillStyle("black");
  5195 + context.setFontSize(21.3 * unit);
  5196 + context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit);
  5197 + context.setFillStyle("#FF6768");
  5198 + context.setFontSize(21.3 * unit);
  5199 + context.fillText(delta2, 160 * unit, 806 * unit);
  5200 + context.setFillStyle("black");
  5201 + context.setFontSize(21.3 * unit);
  5202 + context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit);
  5203 +
  5204 + // 并得帮团惊喜礼品
  5205 + context.setFillStyle("black")
  5206 + context.setFontSize(21.3 * unit)
  5207 + context.fillText("并得帮团", 40 * unit, 840 * unit);
  5208 + context.setFillStyle("#FF6768")
  5209 + context.setFontSize(21.3 * unit)
  5210 + context.fillText("惊喜礼品", 130 * unit, 840 * unit);
  5211 + context.setFillStyle("black")
  5212 + context.setFontSize(21.3 * unit)
  5213 + context.fillText("!", 220 * unit, 840 * unit);
  5214 + }
5162 5215  
5163 5216 //---二维吗图---
5164 5217 //-- 自定义海报 --
5165   - if (th.data.poster) {
  5218 + if (th.data.share_b_img && th.data.poster) {
5166 5219 var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
5167 5220 var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
5168 5221 context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
5169 5222 } else {
5170 5223 //---二维吗图---
5171   - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
  5224 + // context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
5172 5225 }
5173 5226  
5174 5227 break;
... ... @@ -5178,7 +5231,7 @@ Page({
5178 5231  
5179 5232  
5180 5233 //--- 如果是自定义海报的时候 ---
5181   - if (type != 0) {
  5234 + if ( th.data.share_b_img || type != 9) {
5182 5235  
5183 5236 if (th.data.poster && parseInt(th.data.poster.style) == 2) {
5184 5237  
... ... @@ -5352,7 +5405,7 @@ Page({
5352 5405  
5353 5406  
5354 5407  
5355   - //--获取头像的本地缓存,回调写法--
  5408 + //--获取头像的本地缓存,回调写法--
5356 5409 get_head_temp: function (tt, func) {
5357 5410 var ee = this;
5358 5411 if (ee.data.share_head) {
... ...
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
... ... @@ -899,7 +899,7 @@
899 899 <view class="shopping-cart cart-ico new_split">
900 900 <navigator open-type="switchTab" url="/pages/cart/cart/cart">
901 901 <image class="sc-img" src="{{iurl}}/miniapp/images/shopping-cart.png"></image>
902   - <view class="cart-num ellipsis-1">{{cartGoodsNum}}</view>
  902 + <!-- <view class="cart-num ellipsis-1">{{cartGoodsNum}}</view> -->
903 903 <view>购物车</view>
904 904 </navigator>
905 905 </view>
... ...
packageC/pages/presell/goodsInfo/goodsInfo.wxml
... ... @@ -939,7 +939,7 @@
939 939 <canvas canvas-id='share' style='width:750rpx;height:1217rpx;background-color:white;' wx:if='{{!canvasHidden}}'></canvas>
940 940 <warn id="warn"></warn>
941 941 <!-- 分享控件,底部弹出 -->
942   -<share id="share_button" bind:send="send" bind:cancel="cancel" bind:share_img="saveImageToPhotosAlbum" wx:if="{{share_hidden}}"></share>
  942 +<share id="share_button" bind:send="send" bind:cancel="cancel" bind:share_img="saveImageFn" wx:if="{{share_hidden}}"></share>
943 943 <view wx:if="{{showPoster}}">
944 944 <view class="mask" catchtap="closePoster"></view>
945 945 <view class="poster-container">
... ... @@ -951,7 +951,10 @@
951 951 <text class="iconfont icon-close"></text>
952 952 </view>
953 953 </view>
954   -
  954 + <view class="btn-container">
  955 + <!-- <button class="btn-share" open-type="share" bindtap="">微信好友分享</button> -->
  956 + <button class="btn-share" bindtap="savePic">保存到相册</button>
  957 + </view>
955 958 </view>
956 959 </view>
957 960 </view>
... ...
packageD/pages/user/coupons/coupons.js
... ... @@ -118,7 +118,7 @@ Page({
118 118 let url = `/pages/goods/goodsInfo/goodsInfo?goods_id=${item.goods_id}&prom_type=${item.prom_type}&prom_id=${item.prom_id}`
119 119 getApp().goto(url)
120 120 }else{
121   - getApp().showWarning("未找到该商品");
  121 + getApp().showWarning("该商品不存在");
122 122 }
123 123 }
124 124 }
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -5030,11 +5030,15 @@ Page({
5030 5030 if (this.data.card_field && this.data.data[this.data.card_field]) {
5031 5031 price = this.data.data[this.data.card_field];
5032 5032 }
5033   - if (this.data.prom_act) price = this.data.prom_price;
  5033 + if (this.data.prom_act) price = this.data.prom_price;
5034 5034 price = parseFloat(price).toFixed(2);
5035 5035 context.setFontSize(32 * unit);
5036   - context.setFillStyle('#DE1117');
5037   - context.fillText('¥' + price, 54 * unit, 735 * unit);
  5036 + context.setFillStyle('#DE1117');
  5037 + if (this.data.prom_type == 4 && this.data.prom_integral){
  5038 + context.fillText(this.data.prom_integral+'积分+¥' + price, 54 * unit, 735 * unit);
  5039 + }else{
  5040 + context.fillText('¥' + price, 54 * unit, 735 * unit);
  5041 + }
5038 5042  
5039 5043  
5040 5044 };
... ... @@ -5225,6 +5229,11 @@ Page({
5225 5229 var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25;
5226 5230 context.fillText("¥", wd1 - 15, 185 * unit);
5227 5231 context.setFontSize(31 * unit)
  5232 + // if(th.data.prom_type==4){
  5233 + // context.fillText(th.data.prom_integral+'积分'+pri0, wd1, 185 * unit);
  5234 + // }else{
  5235 + // context.fillText(pri0, wd1, 185 * unit);
  5236 + // }
5228 5237 context.fillText(pri0, wd1, 185 * unit);
5229 5238  
5230 5239 //---市场价划掉---
... ...