diff --git a/common/common-framework/pom.xml b/common/common-framework/pom.xml index e5ba8581..e88edb5f 100644 --- a/common/common-framework/pom.xml +++ b/common/common-framework/pom.xml @@ -64,8 +64,25 @@ org.apache.commons commons-lang3 + + org.mybatis + mybatis + 3.5.0 + + + com.fasterxml.jackson.core + jackson-databind + 2.9.8 + compile + + + com.fasterxml.jackson.core + jackson-annotations + 2.9.7 + compile + - \ No newline at end of file + diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/mybatis/JSONTypeHandler.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/mybatis/JSONTypeHandler.java new file mode 100644 index 00000000..b68ced70 --- /dev/null +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/mybatis/JSONTypeHandler.java @@ -0,0 +1,70 @@ +package cn.iocoder.common.framework.mybatis; + +import com.alibaba.fastjson.JSON; +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * TODO 芋艿 + * + * 参考 https://www.cnblogs.com/waterystone/p/5547254.html + * + * 后续,补充下注释和测试类,以及文章。 + * + * @param + */ +public class JSONTypeHandler extends BaseTypeHandler { + + private Class clazz; + + public JSONTypeHandler(Class clazz) { + if (clazz == null) throw new IllegalArgumentException("Type argument cannot be null"); + this.clazz = clazz; + } + + @Override + public void setNonNullParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType) throws SQLException { + ps.setString(i, this.toJson(parameter)); + } + + @Override + public T getNullableResult(ResultSet rs, String columnName) throws SQLException { + return this.toObject(rs.getString(columnName), clazz); + } + + @Override + public T getNullableResult(ResultSet rs, int columnIndex) throws SQLException { + return this.toObject(rs.getString(columnIndex), clazz); + } + + @Override + public T getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { + return this.toObject(cs.getString(columnIndex), clazz); + } + + private String toJson(T object) { + try { + return JSON.toJSONString(object); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private T toObject(String content, Class> clazz) { + if (content != null && !content.isEmpty()) { + try { + return (T) JSON.parseObject(content, clazz); + } catch (Exception e) { + throw new RuntimeException(e); + } + } else { + return null; + } + } + +} diff --git a/mobile-web/src/api/order.js b/mobile-web/src/api/order.js index edc977ca..fda924a2 100644 --- a/mobile-web/src/api/order.js +++ b/mobile-web/src/api/order.js @@ -120,6 +120,16 @@ export function getCartConfirmCreateOrder(skuId, quantity) { }); } +export function getCartCalcSkuPrice(skuId) { + return request({ + url: '/order-api/users/cart/calc_sku_price', + method: 'get', + params: { + skuId, + } + }); +} + // 物流信息 export function getLogisticsInfo(params) { diff --git a/mobile-web/src/page/product/detail.vue b/mobile-web/src/page/product/detail.vue index a69c48a6..759ce9e9 100644 --- a/mobile-web/src/page/product/detail.vue +++ b/mobile-web/src/page/product/detail.vue @@ -7,27 +7,13 @@ - - - ¥2.8 - - ¥14 - 限时抢购 - - - - 距离结束仅剩 - 714202 - - - - - {{ formatPrice(initialSku.price) }} - - {{ spu.name }} - {{spu.sellPoint}} - + + {{ formatPrice(initialSku.price) }} + + {{ spu.name }} + {{spu.sellPoint}} + @@ -79,6 +65,25 @@ + + + + + + + + + 满减 + 满100元减50元 + + + + + 限购 + 购买不超过5件时享受单件价¥8.00,超出数量以结算价为准 + + + 图文详情 @@ -99,28 +104,6 @@ - - - - - - - - - - - - - - - - - - - - - - @@ -181,8 +164,8 @@
距离结束仅剩
图文详情