小程序礼包

This commit is contained in:
liupopo
2024-01-09 13:58:30 +08:00
parent 5db951316f
commit 5eca4d8297
6 changed files with 53 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ public class AppletGiftBagInitVo implements Vo {
private String price;
private String iconUrl;
private String isRecommend;
private String preferentialPrice;
//商品sid
private List<GiftBagGoods> goods = new ArrayList<>();
}

View File

@@ -1,5 +1,6 @@
package com.yxt.yyth.api.appletgiftbag;
import cn.hutool.core.util.NumberUtil;
import com.yxt.common.base.utils.StringUtils;
import lombok.Data;
@@ -13,7 +14,7 @@ import java.text.DecimalFormat;
@Data
public class GiftBagGoods {
private String goodsSid;
private String goodsNumber="0";//份数
private String goodsNumber = "0";//份数
private String name; //商品名
private String unitName; //单位
private String price; //商品单价
@@ -26,10 +27,50 @@ public class GiftBagGoods {
public String getJPrice() {
if(StringUtils.isBlank(jPrice)){
jPrice ="0";
if (StringUtils.isBlank(jPrice)) {
jPrice = "0";
}
DecimalFormat decimalFormat = new DecimalFormat("#0.00");
return decimalFormat.format(Double.valueOf(jPrice));
}
public String getMefenPrice() {
double dj = 0.0;
try {
dj = Double.parseDouble(price);
} catch (Exception e) {
e.printStackTrace();
}
int js = 1;
try {
js = Integer.parseInt(weight);
} catch (Exception e) {
e.printStackTrace();
}
double mfjg = dj * js;
return NumberUtil.decimalFormatMoney(mfjg);
}
public String getSubtotal() {
double dj = 0.0;
try {
dj = Double.parseDouble(price);
} catch (Exception e) {
e.printStackTrace();
}
int js = 1;
try {
js = Integer.parseInt(weight);
} catch (Exception e) {
e.printStackTrace();
}
int fs = 1;
try {
fs = Integer.parseInt(goodsNumber);
} catch (Exception e) {
e.printStackTrace();
}
double mfjg = dj * js * fs;
return NumberUtil.decimalFormatMoney(mfjg);
}
}

View File

@@ -35,5 +35,6 @@ public class LpkGoodsVo implements Vo {
private String isAppletGrounding; //1 上架 2 下架
private String content;
private String useTo;
private String weight;
}

View File

@@ -163,6 +163,8 @@ public class AppletGiftBagService extends MybatisBaseService<AppletGiftBagMapper
if (StringUtils.isNotBlank(lpkGoods.getPrice())) {
bagGoods.setPrice(lpkGoods.getPrice());
}
bagGoods.setWeight(lpkGoods.getWeight());
bagGoods.setSpecificationUnit(lpkGoods.getSpecificationUnit());
}
}
goods.add(bagGoods);

View File

@@ -6,7 +6,7 @@
<delete id="deleteGoodsByBagSid">
DELETE
FROM lpk_giftbag_goods
FROM applet_giftbag_goods
WHERE giftbagSid = #{sid}
</delete>
<select id="getRecordsByBagSid" resultType="com.yxt.yyth.api.appletgiftbaggoods.AppletGiftBagGoods">
@@ -15,7 +15,7 @@
WHERE giftbagSid = #{sid}
</select>
<insert id="saveBagGoods" parameterType="java.util.List">
insert into lpk_giftbag_goods(sid,createTime,giftbagSid,goodsSid,goodsNumber)
insert into applet_giftbag_goods(sid,createTime,giftbagSid,goodsSid,goodsNumber)
values
<foreach collection="bagGoods" item="item" index="index" separator=",">
(#{item.sid},#{item.createTime},#{item.giftbagSid},#{item.goodsSid},#{item.goodsNumber})

View File

@@ -10,6 +10,7 @@
date_format(createTime, '%Y-%m-%d') as createTime,
code,
barcode,
`weight`,
`name`,
unitName,
typeCode,
@@ -29,6 +30,7 @@
date_format(createTime, '%Y-%m-%d') as createTime,
code,
barcode,
`weight`,
`name`,
unitName,
typeCode,
@@ -44,6 +46,7 @@
date_format(createTime, '%Y-%m-%d') as createTime,
code,
barcode,
`weight`,
`name`,
unitName,
typeCode,