Explorar el Código

商品模块化 联调

zhengjinyi hace 4 años
padre
commit
bff867eb9f

+ 1 - 1
src/main/resources/static/js/common/serviceapi/pages.service.js

@@ -19,7 +19,7 @@ var PagesApi = {
         },
         /* 活动商品专题列表 */
         GetPromotionsListData: function (params, callback) {
-            Http.AjaxService({ url:'/promotions/list', type:'GET', data:params, json:false})
+            Http.AjaxService({ url:'/commodity/promotions/list', type:'GET', data:params, json:false})
             .then(function(res){
                 callback(res);
             });

+ 18 - 1
src/main/resources/static/js/common/serviceapi/product.service.js

@@ -46,5 +46,22 @@ var ProductApi = {
                     callback(res);
                 });
         },
-
+        GetSearchEquipmentList:function (params, callback) {//搜索项目仪器列表查询
+            Http.AjaxService({ url:'/commodity/search/query/equipment', type:'get', data:params, json:true, isHost:true})
+                .then(function(res){
+                    callback(res);
+                });
+        },
+        GetPromotionsInfo:function (params, callback) {//获取促销活动详情
+            Http.AjaxService({ url:'/commodity/promotions/info', type:'get', data:params, json:true, isHost:true})
+                .then(function(res){
+                    callback(res);
+                });
+        },
+        GetPromotionsProduct:function (params, callback) {//获取促销活动详情
+            Http.AjaxService({ url:'/commodity/promotions/product', type:'get', data:params, json:true, isHost:true})
+                .then(function(res){
+                    callback(res);
+                });
+        },
 };

+ 2 - 2
src/main/resources/static/js/common/serviceapi/second.service.js

@@ -5,7 +5,7 @@
  */
 var SecondApi = {
         SecondHandProduct: function (params, callback) {//发布信息
-            Http.AjaxService({ url:'/product/releaseSecondHandProduct', type:'post', data:params, json:false, mask:true,replace:false})
+            Http.AjaxService({ url:'/commodity/second/release', type:'post', data:params, json:false, mask:true,replace:false, isHost:true})
             .then(function(res){
                 callback(res);
             });
@@ -14,7 +14,7 @@ var SecondApi = {
             Http.uploadImage({ url:'/formData/MultiPictareaddData',data:params},callback)
         },
         SeconHandProductList: function (params, callback) {//商品列表
-            Http.AjaxService({ url:'/product/getSecondHandProductList', type:'get', data:params, json:true, mask:true,replace:false})
+            Http.AjaxService({ url:'/commodity/second/list', type:'get', data:params, json:true, mask:true,replace:false, isHost:true})
             .then(function(res){
                 callback(res);
             });

+ 6 - 0
src/main/resources/static/js/common/serviceapi/supplier.service.js

@@ -4,6 +4,12 @@
  * auther ZHJY
  */
 var SupplierApi = {
+        GetSearchShopList:function (params, callback) {//搜索供应商列表查询
+            Http.AjaxService({ url:'/commodity/search/query/shop', type:'get', data:params, json:true, isHost:true})
+                .then(function(res){
+                    callback(res);
+                });
+        },
         ShipmentsInfo: function (params, callback) {//发货商品初始化
             Http.AjaxService({ url:'/supplier/shipmentsInfo', type:'GET', data:params, json:true})
             .then(function(res){

+ 12 - 10
src/main/resources/static/js/equipment/list.js

@@ -50,20 +50,20 @@ var equipmentList = new Vue({
         },
         getListByKeyword: function () {
             var _self = this;
-            $.getJSON(spiServer+"/search/query/equipment", {
+            ProductApi.GetSearchEquipmentList({
                 keyword: this.params.keyword,
                 pageSize: this.params.size,
                 pageNum: this.params.num
-            }, function (r) {
-                if (r.code === 0 && r.data) {
-                    var result = JSON.parse(r.data);
+            },function (res) {
+                if (res.code === 0 && res.data) {
+                    var result = JSON.parse(res.data);
                     _self.listRecord = result.total;
                     var resultData = [];
                     result.items.map(function (su) {
                         resultData.push({
-                            id: su.e_id,
-                            name: su.e_name,
-                            image: su.e_image
+                            id: su.id,
+                            name: su.name,
+                            image: su.image
                         });
                     });
                     if(isPC){
@@ -75,10 +75,12 @@ var equipmentList = new Vue({
                         // 图片懒加载
                         $("img[data-original]").lazyload();
                     },500);
+                    _self.listLoading = false;
+                    _self.requestFlag = true;
+                }else {
+                    CAIMEI.Alert(res.msg, '确定');
                 }
-                _self.listLoading = false;
-                _self.requestFlag = true;
-            })
+            });
         },
 
     },

+ 8 - 8
src/main/resources/static/js/flea-market/form.js

@@ -31,12 +31,12 @@ var fleaMarketForm = new Vue({
             secondHandType:'',//一级分类
             instrumentType:'',//二手仪器分类
             name:'',
-            brandID:'',//品牌ID
+            brandId:'',//品牌ID
             brandName:'',//其他品牌
             fixedYears:null,//出厂
             companyName:'',//公司名称
             // maturityYears:'',//产品到期
-            price1:'',//交易价
+            price:'',//交易价
             detailTalkFlag:1,//是否启用详聊
             // normalPrice:'',//市场价
             // originalPrice:'',//采购价
@@ -47,7 +47,7 @@ var fleaMarketForm = new Vue({
             secondProductType:'',//
             townId:'',//县区地址
             address:'',//详细地址
-            image1:'',//图片
+            image:'',//图片
             productDetails:'',//商品详细信息
             source:1,
             dockingPeopleMobile:'',
@@ -122,8 +122,8 @@ var fleaMarketForm = new Vue({
         ChangeBrand:function(item){ //品牌列表
          var _this = this;
             _this.brandname = item.name;
-            _this.secondParams.brandID = item.id;
-            if(_this.secondParams.brandID==161){
+            _this.secondParams.brandId = item.id;
+            if(_this.secondParams.brandId==161){
               _this.shoplogoTwo = true;
             }else {
               _this.shoplogoTwo = false;
@@ -149,14 +149,14 @@ var fleaMarketForm = new Vue({
             _this.formData.append('file', file[0]);
             SecondApi.uploadimg(_this.formData,function(response){
                _this.GoodsImagesList.push(response.data);
-               _this.secondParams.image1 =_this.GoodsImagesList.toString()+',';
+               _this.secondParams.image =_this.GoodsImagesList.toString()+',';
                 event.target.value = '';
             });
         },
          removeGoodsImagesFn: function(index){//删除商品图片
             var _this = this;
             _this.GoodsImagesList.splice(index,1);
-            _this.secondParams.image1 =_this.GoodsImagesList.toString()+',';
+            _this.secondParams.image =_this.GoodsImagesList.toString()+',';
          },
         getProductType:function(item){
         var _this = this;
@@ -204,7 +204,7 @@ var fleaMarketForm = new Vue({
                 },2000);
                 return
          }
-         if(_this.secondParams.price1 == ''){
+         if(_this.secondParams.price == ''){
                   _this.vShow_Price = true;
                   _this.fromMessage = '请输入交易价';
                   _this.scrollIntoView();

+ 17 - 14
src/main/resources/static/js/product/promotions.js

@@ -53,27 +53,28 @@ var promotionsList = new Vue({
         },
         getPromotions: function(){
             var _self = this;
-            $.getJSON(spiServer+"/product/promotion/info?promotionsId="+this.params.id, function (r) {
-                if (r.code === 0 && r.data) {
-                    _self.promotions = r.data;
+            ProductApi.GetPromotionsInfo({promotionsId:this.params.id},function (res) {
+                if (res.code === 0 && res.data) {
+                    _self.promotions = res.data;
                     _self.getProductsByPromotions();
                 }else{
                     CAIMEI.Alert("该促销活动已过期或不存在!", '确定', true, function(){
                         window.location.href="/";
                     });
                 }
-            })
+            });
         },
         getProductsByPromotions: function () {
             var _self = this;
-            $.getJSON(spiServer+"/product/promotion/products",{
+            ProductApi.GetPromotionsProduct({
                 promotionsId: this.params.id,
                 pageSize: this.params.size,
-                pageNum: this.params.num
-            },function (r) {
-                if (r.code === 0 && r.data) {
-                    _self.listRecord = r.data.total;
-                    var resultData = r.data.list;
+                pageNum: this.params.num,
+                identity:this.userIdentity
+            },function (res) {
+                if (res.code === 0 && res.data) {
+                    _self.listRecord = res.data.total;
+                    var resultData = res.data.list;
                     var productIdArr = [];
                     resultData.map(function (item) {
                         productIdArr.push(item.id)
@@ -86,11 +87,13 @@ var promotionsList = new Vue({
                     }else{
                         _self.listData = _self.listData.concat(resultData);
                     }
-                    console.log(_self.listData)
+                    console.log(_self.listData);
+                    _self.listLoading = false;
+                    _self.requestFlag = true;
+                }else{
+                    CAIMEI.Alert(res.msg, '确定');
                 }
-                _self.listLoading = false;
-                _self.requestFlag = true;
-            })
+            });
         }
     },
     created: function () {

+ 15 - 13
src/main/resources/static/js/supplier/list.js

@@ -51,13 +51,13 @@ var supplierList = new Vue({
         },
         getListByKeyword: function () {
             var _self = this;
-            $.getJSON(spiServer+"/search/query/supplier", {
+            SupplierApi.GetSearchShopList({
                 keyword: this.params.keyword,
                 pageSize: this.params.size,
                 pageNum: this.params.num
-            }, function (r) {
-                if (r.code === 0 && r.data) {
-                    var result = JSON.parse(r.data);
+            },function (res) {
+                if (res.code === 0 && res.data) {
+                    var result = JSON.parse(res.data);
                     console.log(result);
                     _self.listRecord = result.total;
                     var resultData = [];
@@ -72,12 +72,12 @@ var supplierList = new Vue({
                             });
                         }
                         resultData.push({
-                            id: su.s_id,
-                            name: su.s_name,
-                            license: su.s_license,
-                            logo: su.s_logo,
-                            businessScope: su.s_business,
-                            address: su.s_address,
+                            id: su.id,
+                            name: su.name,
+                            license: su.license,
+                            logo: su.logo,
+                            businessScope: su.business,
+                            address: su.address,
                             productList: productList
                         });
                     });
@@ -86,10 +86,12 @@ var supplierList = new Vue({
                     }else{
                         _self.listData = _self.listData.concat(resultData);
                     }
+                    _self.listLoading = false;
+                    _self.requestFlag = true;
+                }else {
+                    CAIMEI.Alert(res.msg, '确定');
                 }
-                _self.listLoading = false;
-                _self.requestFlag = true;
-            })
+            });
         },
 
     },

+ 1 - 0
src/main/resources/templates/equipment/list.html

@@ -53,6 +53,7 @@
 <!-- 引入底部 -->
 <template th:replace="components/footer"></template>
 <template th:replace="components/foot-link"></template>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/product.service.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/equipment/list.js(v=${version})}"></script>
 </body>
 </html>

+ 1 - 1
src/main/resources/templates/flea-market/form.html

@@ -66,7 +66,7 @@
                      <div class="unlogin-item input-item shrink-spacing" >
                         <div class="unlogin-label spacing" style="letter-spacing: 1px;"><span class="red-color">*</span>交易价:</div>
                         <input type="text" style="width: 288px;" maxlength="20" id="shopprice"   oninput="value=value.replace(/[^\d]/g, '')"
-                           v-model="secondParams.price1"  placeholder="请输入交易价">
+                           v-model="secondParams.price"  placeholder="请输入交易价">
                         <label class="xiangliao" style="color: #E15616;;margin-left: 15px;position: relative;font-size: 14px">
                         <input type="checkbox" name="Detailed_chat" v-model="secondParams.detailTalkFlags" @click="Detailed($event)" id="Detailed"><label for="Detailed" class="transactionbox"></label>价格详聊</label>
                         <span class="showflag" v-show="vShow_detailTalkFlag">(勾选代表同意不显示交易价)</span>

+ 1 - 1
src/main/resources/templates/flea-market/list.html

@@ -71,7 +71,7 @@
                             <span v-if="item.detailTalkFlag ==2 && userID==null">价格详聊</span>
                             <span v-else-if="userID==null" class="priceparam" @click="toLogin">登录查看价格></span>
                             <span v-else-if="userID!=null && item.detailTalkFlag==2">价格详聊</span>
-                            <span v-else>¥{{item.price1Str}}</span>
+                            <span v-else>¥{{ item.price }}</span>
                         </div>
                         <div class="shijian">
                             <div>

+ 1 - 0
src/main/resources/templates/product/promotions.html

@@ -98,6 +98,7 @@
 <!-- 引入底部 -->
 <template th:replace="components/footer"></template>
 <template th:replace="components/foot-link"></template>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/product.service.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/product/promotions.js(v=${version})}"></script>
 </body>
 </html>

+ 1 - 0
src/main/resources/templates/supplier/list.html

@@ -77,6 +77,7 @@
 <!-- 引入底部 -->
 <template th:replace="components/footer"></template>
 <template th:replace="components/foot-link"></template>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/supplier.service.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/supplier/list.js(v=${version})}"></script>
 </body>
 </html>