Browse Source

价格可见度

chao 4 years ago
parent
commit
53bee3ae50

+ 2 - 2
.gitignore

@@ -1,8 +1,8 @@
 HELP.md
 /target/**/
-/target/generated-sources/
-/target/generated-test-sources/
+/target/*.original
 !target/*.jar
+!/target/*.jar
 !.mvn/wrapper/maven-wrapper.jar
 !**/src/main/**
 !**/src/test/**

+ 2 - 0
src/main/java/com/caimei/www/pojo/page/ProductList.java

@@ -25,6 +25,8 @@ public class ProductList implements Serializable {
 	private Integer priceGrade;
 	/** 首页活动角标标识类型:1推荐热销、2推荐上新*/
 	private Integer actType;
+	/** 商品可见度: 3:所有人可见,2:普通机构可见,1:会员机构可见 */
+	private Integer visibility;
 
     private static final long serialVersionUID = 1L;
 }

+ 1 - 0
src/main/resources/mapper/ProductMapper.xml

@@ -18,6 +18,7 @@
 			p.minBuyNumber as minBuyNumber,
 			p.step as step,
 			p.recommendType as recommendType,
+			p.visibility as visibility,
 
 			d.detailInfo as detailInfo,
 			d.orderInfo as orderInfo,

+ 6 - 0
src/main/resources/static/js/product/detail.js

@@ -1,6 +1,7 @@
 var productDetail = new Vue({
     el: "#productDetail",
     data: {
+        showProduct: false,
         productId: 0,
         userId: 0,
         number: 0,
@@ -251,6 +252,11 @@ var productDetail = new Vue({
         this.productId = $("#productId").val();
         this.productStock = $("#productStock").val();
         this.getImages();
+        // identity: 0个人,1协销,2会员机构,3供应商,4普通机构
+        // visibility:3:所有人可见,2:普通机构可见,1:会员机构可见
+        var visible = $("#productVisibility").val()*1;
+        var identity = GLOBAL_USER_IDENTITY;
+        this.showProduct = (identity === 1 || identity === 2) || (identity === 4 && (visible === 2 || visible === 3)) || (visible === 3);
     },
     mounted: function () {
         this.userId = GLOBAL_USER_ID;

+ 2 - 0
src/main/resources/static/js/product/list.js

@@ -72,6 +72,7 @@ var productList = new Vue({
             var _self = this;
             $.getJSON(spiServer+"/search/query/product", {
                 keyword: this.params.keyword,
+                identity: GLOBAL_USER_IDENTITY,
                 pageSize: this.params.size,
                 pageNum: this.params.num,
                 sortField: this.params.sortField,
@@ -138,6 +139,7 @@ var productList = new Vue({
             var _self = this;
             $.getJSON(spiServer+"/search/query/product/"+ path ,{
                 id: categoryId,
+                identity: GLOBAL_USER_IDENTITY,
                 pageSize: this.params.size,
                 pageNum: this.params.num,
                 sortField: this.params.sortField,

+ 1 - 0
src/main/resources/static/js/supplier/index.js

@@ -97,6 +97,7 @@ var supplierHome = new Vue({
                 keyword: _self.params.keyword,
                 pageSize: _self.params.size,
                 pageNum: _self.params.num,
+                identity: GLOBAL_USER_IDENTITY,
                 id:_self.params.id
             }, function (r) {
                 if (r.code === 0 && r.data) {

+ 2 - 1
src/main/resources/templates/product/detail.html

@@ -12,9 +12,10 @@
 <template th:replace="components/header"></template>
 
 <!-- 商品详情 -->
-<div id="productDetail">
+<div id="productDetail" v-show="showProduct">
     <input type="hidden" th:value="${productId}" id="productId">
     <input type="hidden" th:value="${product?.stock}" id="productStock">
+    <input type="hidden" th:value="${product?.visibility}" id="productVisibility">
     <div class="wrap">
         <div class="productBox clear">
             <div class="imageBox" id="imgShown">

BIN
target/www-0.0.1-SNAPSHOT.jar