Explorar o código

:hamster: 商品详细页添加更多信息(卖家信息,交易方式等)

nnkwrik %!s(int64=6) %!d(string=hai) anos
pai
achega
759414f6f5

+ 13 - 1
goods-service/src/main/java/io/github/nnkwrik/goodsservice/dao/GoodsMapper.java

@@ -63,7 +63,12 @@ public interface GoodsMapper {
             "       `desc`,\n" +
             "       want_count,\n" +
             "       browse_count,\n" +
-            "       last_edit\n" +
+            "       last_edit,\n" +
+            "       postage,\n" +
+            "       region,\n" +
+            "       able_express,\n" +
+            "       able_meet,\n" +
+            "       able_self_take\n" +
             "from goods\n" +
             "where id = #{goodsId}")
     Goods findDetailGoodsByGoodsId(@Param("goodsId") int goodsId);
@@ -155,4 +160,11 @@ public interface GoodsMapper {
             "#{desc}," +
             "#{regionId},#{region},#{ableExpress},#{ableMeet},#{ableSelfTake});")
     void addGoods(Goods goods);
+
+    @Select("select COUNT(*)\n" +
+            "from goods\n" +
+            "where seller_id = #{seller_id}\n" +
+            "  and is_on_sale = false\n" +
+            "  and is_delete = false;")
+    Integer getGellerHistory(@Param("seller_id") String sellerId);
 }

+ 10 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/model/vo/inner/GoodsDetailVo.java

@@ -15,5 +15,15 @@ public class GoodsDetailVo extends GoodsSimpleVo {
     private Integer want_count;
     private Integer browse_count;
     private String last_edit;
+
+    private Double postage;
+    private String region;
+
+    private Boolean ableExpress;
+    private Boolean ableMeet;
+    private Boolean ableSelfTake;
+
+
     private SimpleUser seller;
+    private Integer sellerHistory;
 }

+ 4 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/service/impl/GoodsServiceImpl.java

@@ -78,6 +78,10 @@ public class GoodsServiceImpl implements GoodsService {
         }
         goodsDetailVo.setSeller(response.getData());
 
+        //卖家出售过的商品数
+        Integer sellerHistory = goodsMapper.getGellerHistory(detailGoods.getSellerId());
+        goodsDetailVo.setSellerHistory(sellerHistory);
+
         return goodsDetailVo;
     }
 

+ 2 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/util/PO2VO.java

@@ -64,6 +64,8 @@ public class PO2VO {
                     SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                     vo.setLast_edit(formatter.format(po.getLastEdit()));
                 }
+
+                BeanUtils.copyProperties(po, vo);
                 return vo;
             };
 

+ 0 - 1
wx-front/app.json

@@ -18,7 +18,6 @@
     "pages/ucenter/index/index",
     "pages/topic/topic",
     "pages/comment/comment",
-    "pages/commentPost/commentPost",
     "pages/topicComment/topicComment",
     "pages/brand/brand",
     "pages/brandDetail/brandDetail",

+ 1 - 1
wx-front/config/api.js

@@ -1,4 +1,4 @@
-const ApiRootUrl = 'http://8456bb23.ngrok.io/';
+const ApiRootUrl = 'https://5d876383.ngrok.io/';
 // const ApiRootUrl = 'http://127.0.0.1:8080/';
 
 module.exports = {

+ 0 - 80
wx-front/pages/commentPost/commentPost.js

@@ -1,80 +0,0 @@
-var app = getApp();
-var util = require('../../utils/util.js');
-var api = require('../../config/api.js');
-Page({
-  data: {
-    typeId: 0,
-    valueId: 0,
-    content: ''
-  },
-  onLoad: function (options) {
-
-    var that = this;
-    that.setData({
-      typeId: parseInt(options.typeId),
-      valueId: parseInt(options.valueId)
-    });
-
-  },
-  onClose() {
-    wx.navigateBack({
-      delta: 1
-    });
-  },
-  onPost() {
-    let that = this;
-
-    if (!this.data.content) {
-      util.showErrorToast('请填写评论')
-      return false;
-    }
-
-
-    util.request(api.CommentPost, {
-      typeId: that.data.typeId,
-      valueId: that.data.valueId,
-      content: that.data.content
-    }, 'POST').then(function (res) {
-      if (res.errno === 0) {
-        wx.showToast({
-          title: '评论成功',
-          complete: function(){
-            wx.navigateBack({
-              delta: 1
-            });
-          }
-        })
-      }
-      console.log(res)
-    });
-  },
-  bindInpuntValue(event){
-
-    let value = event.detail.value;
-
-    //判断是否超过140个字符
-    if (value && value.length > 140) {
-      return false;
-    }
-
-    this.setData({
-      content: event.detail.value,
-    })
-    console.log(event.detail)
-  },
-  onReady: function () {
-
-  },
-  onShow: function () {
-    // 页面显示
-
-  },
-  onHide: function () {
-    // 页面隐藏
-
-  },
-  onUnload: function () {
-    // 页面关闭
-
-  }
-})

+ 0 - 3
wx-front/pages/commentPost/commentPost.json

@@ -1,3 +0,0 @@
-{
-  "navigationBarTitleText": "发布宝贝"
-}

+ 0 - 28
wx-front/pages/commentPost/commentPost.wxml

@@ -1,28 +0,0 @@
-<view class="container">
-  <view class="post-comment">
-    <textarea class="title" focus="true" maxlength="60" placeholder="标题,品牌品类都是买家喜欢搜索的" />
-
-    <view class="input-box">
-      <textarea class="content" focus="true" bindinput="bindInpuntValue" maxlength="800" placeholder="描述一下宝贝的转手原因,入手渠道和使用感受" />
-      <text class="count">{{800 - content.length}}</text>
-    </view>
-
-    <view class='post-img'>
-
-    </view>
-
-
-
-
-
-  </view>
-  <view class="detail">
-    <textarea class="price" focus="true" maxlength="8" placeholder="¥0.00" />
-    <textarea class="price" focus="true" maxlength="8" placeholder="¥0.00" />
-    <textarea class="price" focus="true" maxlength="3" placeholder="¥0.00" />
-  </view>
-
-  <view class="bottom-btn">
-    <button class="r">确认发布</button>
-  </view>
-</view>

+ 0 - 110
wx-front/pages/commentPost/commentPost.wxss

@@ -1,110 +0,0 @@
-page, .container {
-  height: 100%;
-  background: #f4f4f4;
-}
-
-.post-comment {
-  width: 750rpx;
-  height: auto;
-  overflow: hidden;
-  padding: 30rpx;
-}
-
-.post-comment .input-box {
-  height: 337.5rpx;
-  width: 690rpx;
-  position: relative;
-  background: #fff;
-}
-
-.post-comment .input-box .content {
-  position: absolute;
-  top: 0;
-  left: 0;
-  display: block;
-  background: #fff;
-  font-size: 29rpx;
-  color: #333;
-  height: 300rpx;
-  width: 650rpx;
-  padding: 20rpx;
-}
-
-.post-comment .title {
-  /* position: absolute; */
-  top: 0;
-  left: 0;
-  display: block;
-  background: #fff;
-  font-size: 29rpx;
-  color: #333;
-  height:35rpx;
-  width: 650rpx;
-  padding: 20rpx;
-  /* margin:10px; */
-  border-bottom: 1px solid #ddd;
-  overflow:hidden;
-}
-
-.post-comment .input-box .count {
-  position: absolute;
-  bottom: 20rpx;
-  right: 20rpx;
-  display: block;
-  height: 30rpx;
-  width: 50rpx;
-  font-size: 29rpx;
-  color: #999;
-}
-
-.post-comment .btns {
-  height: 108rpx;
-}
-
-.post-comment .close {
-  float: left;
-  height: 108rpx;
-  line-height: 108rpx;
-  text-align: left;
-  color: #666;
-  padding: 0 30rpx;
-}
-
-.post-comment .post {
-  float: right;
-  height: 108rpx;
-  line-height: 108rpx;
-  text-align: right;
-  padding: 0 30rpx;
-}
-
-.bottom-btn {
-  position: fixed;
-  left: 0;
-  bottom: 0;
-  z-index: 10;
-  width: 750rpx;
-  /* height: 100rpx; */
-  display: flex;
-  background: #fff;
-  padding:10rpx;
-}
-
-.bottom-btn .r {
-  border: 1px solid #f94b4b;
-  background: #f94b4b;
-  float: left;
-  height: 100rpx;
-  line-height: 96rpx;
-  flex: 1;
-  text-align: center;
-  color: #fff;
-}
-
-.detail {
-  margin-top: 20rpx;
-  width: 750rpx;
-  height: auto;
-  overflow: hidden;
-  padding: 30rpx;
-}

+ 40 - 32
wx-front/pages/goods/goods.js

@@ -15,6 +15,7 @@ Page({
     // brand: {},
     // specificationList: [],
     // productList: [],
+    sellerDates: 0,
     relatedGoods: [],
     cartGoodsCount: 0,
     userHasCollect: 0,
@@ -25,7 +26,7 @@ Page({
     replyId: '',
     replyUserId: '',
     replyUserName: '',
-    commentContent:'',
+    commentContent: '',
     onLoadOption: {},
     noCollectImage: "/static/images/detail_star.png",
     hasCollectImage: "/static/images/detail_star_checked.png",
@@ -35,9 +36,16 @@ Page({
     let that = this;
     util.request(api.GoodsDetail + '/' + that.data.id).then(function(res) {
       if (res.errno === 0) {
+        console.log(res.data.info.seller.registerTime)
+
+        //计算卖家来平台第几天
+        let registerTime = res.data.info.seller.registerTime
+        let duration = new Date().getTime() - new Date(registerTime).getTime() ;
+        let dates = parseInt(Math.floor(duration) / (1000 * 60 * 60 * 24));
         that.setData({
           goods: res.data.info,
           gallery: res.data.gallery,
+          sellerDates: dates,
           // attribute: res.data.attribute,
           // issueList: res.data.issue,
           comment: res.data.comment,
@@ -188,8 +196,8 @@ Page({
     this.setData({
       onLoadOption: options,
       id: parseInt(options.id),
-      commentContent:''
-      
+      commentContent: ''
+
       // id: 1181000
     });
 
@@ -251,7 +259,7 @@ Page({
 
   postComment: function(event) {
     let that = this
-    if (event.detail.value.trim()=='') {
+    if (event.detail.value.trim() == '') {
       util.showErrorToast('请填写内容')
       return false;
     }
@@ -263,15 +271,15 @@ Page({
     }, "POST").then(function(res) {
       if (res.errno === 0) {
         that.setData({
-          commentContent:''
+          commentContent: ''
         })
-        
+
         wx.showToast({
           title: '留言成功'
         })
         //刷新
         that.onLoad(that.data.onLoadOption);
-        
+
 
       }
       console.log(res)
@@ -281,37 +289,37 @@ Page({
 
   addCannelCollect: function() {
     let that = this;
-    user.checkLoginAndNav().then(()=>{
-
-    
-    //添加或是取消收藏
-    util.request(api.CollectAddOrDelete + '/' + this.data.id + '/' + this.data.userHasCollect, {}, "POST")
-      .then(function(res) {
-        let _res = res;
-        let collectState = !that.data.userHasCollect;
-        if (_res.errno == 0) {
-          that.setData({
-            userHasCollect: collectState
-          });
+    user.checkLoginAndNav().then(() => {
+
 
-          if (that.data.userHasCollect) {
+      //添加或是取消收藏
+      util.request(api.CollectAddOrDelete + '/' + this.data.id + '/' + this.data.userHasCollect, {}, "POST")
+        .then(function(res) {
+          let _res = res;
+          let collectState = !that.data.userHasCollect;
+          if (_res.errno == 0) {
             that.setData({
-              'collectBackImage': that.data.hasCollectImage
+              userHasCollect: collectState
             });
+
+            if (that.data.userHasCollect) {
+              that.setData({
+                'collectBackImage': that.data.hasCollectImage
+              });
+            } else {
+              that.setData({
+                'collectBackImage': that.data.noCollectImage
+              });
+            }
+
           } else {
-            that.setData({
-              'collectBackImage': that.data.noCollectImage
+            wx.showToast({
+              image: '/static/images/icon_error.png',
+              title: _res.errmsg,
+              mask: true
             });
           }
-
-        } else {
-          wx.showToast({
-            image: '/static/images/icon_error.png',
-            title: _res.errmsg,
-            mask: true
-          });
-        }
-      });
+        });
     })
   },
   // openCartPage: function () {

+ 25 - 17
wx-front/pages/goods/goods.wxml

@@ -5,8 +5,8 @@
     </swiper-item>
   </swiper>
   <view class="location-time">
-    <view class="icon time">最后编辑 : {{goods.last_edit}}</view>
-    <view class="icon location">地点 : 广东深圳</view>
+    <view class="icon time">最后编辑:{{goods.last_edit}}</view>
+    <view class="icon location">地点:{{goods.region}}</view>
   </view>
   <view class="goods-info">
     <view class="c">
@@ -24,6 +24,14 @@
     </view>
   </view>
   <view class="section-nav section-act">
+    <view class="t" wx:if='{{goods.ableExpress||goods.ableMeet||goods.ableSelfTake}}'>
+      <view class="tag r" wx:if="{{goods.ableExpress}}">{{!goods.postage?'包邮':'邮费:'+goods.postage+'元'}}</view>
+
+      <view class="tag y" wx:if="{{goods.ableExpress}}">支持:邮寄</view>
+      <view class="tag y" wx:if="{{goods.ableMeet}}">支持:同城面交</view>
+      <view class="tag y" wx:if="{{goods.ableSelfTake}}">支持:自提</view>
+
+    </view>
     <view class="t">
       <view class="tag">{{goods.want_count}}人想要</view>
       <view class="tag">浏览 {{goods.browse_count}}</view>
@@ -50,7 +58,7 @@
 
     <view class="seller-info">
       <view class="name">{{goods.seller.nickName}}</view>
-      <view class="history">加入平台第100天,出售过5件宝贝</view>
+      <view class="history">加入平台第{{sellerDates}}天,出售过{{goods.sellerHistory}}件宝贝</view>
     </view>
 
     <image class="i" src="../../static/images/address_right.png" background-size="cover"></image>
@@ -90,23 +98,23 @@
       <text class="t">留言</text>
     </view>
     <view class="b">
-      <view wx:for="{{comment}}"  wx:for-index="index" wx:for-item="item" wx:key="{{item.id}}">
+      <view wx:for="{{comment}}" wx:for-index="index" wx:for-item="item" wx:key="{{item.id}}">
         <!-- comment -->
         <view class="item">
-        <view bindtap="switchCommentPop" data-reply-id="{{item.id}}" data-reply-user-id="{{item.simpleUser.openId}}" data-reply-user-name='{{item.simpleUser.nickName}}'>
-          <view class="info">
-            <view class="user">
-              <image src="{{item.simpleUser.avatarUrl}}"></image>
-              <text>{{item.simpleUser.nickName}}</text>
+          <view bindtap="switchCommentPop" data-reply-id="{{item.id}}" data-reply-user-id="{{item.simpleUser.openId}}" data-reply-user-name='{{item.simpleUser.nickName}}'>
+            <view class="info">
+              <view class="user">
+                <image src="{{item.simpleUser.avatarUrl}}"></image>
+                <text>{{item.simpleUser.nickName}}</text>
+              </view>
+              <view class="time">{{item.create_time}}</view>
+            </view>
+            <view class="content">
+              {{item.content}}
             </view>
-            <view class="time">{{item.create_time}}</view>
-          </view>
-          <view class="content">
-            {{item.content}}
-          </view>
           </view>
           <!-- reply -->
-          <view wx:for="{{item.replyList}}" wx:for-index="iindex" wx:for-item="iitem" wx:key="{{iitem.id}}" bindtap="switchCommentPop" data-reply-id="{{iitem.id}}" data-reply-user-id="{{iitem.simpleUser.openId}}" data-reply-user-name='{{iitem.simpleUser.nickName}}' >
+          <view wx:for="{{item.replyList}}" wx:for-index="iindex" wx:for-item="iitem" wx:key="{{iitem.id}}" bindtap="switchCommentPop" data-reply-id="{{iitem.id}}" data-reply-user-id="{{iitem.simpleUser.openId}}" data-reply-user-name='{{iitem.simpleUser.nickName}}'>
             <view class="reply-info">
               <view class="reply-user">
                 <image src="{{iitem.simpleUser.avatarUrl}}"></image>
@@ -231,10 +239,10 @@
     </view> -->
     <view class="post-comment">
       <view class="title" wx:if="{{replyUserName}}">
-      回复@{{replyUserName}}:
+        回复@{{replyUserName}}:
       </view>
       <view class="title" wx:else>
-      发表留言:
+        发表留言:
       </view>
 
       <view class="content">

+ 32 - 20
wx-front/pages/goods/goods.wxss

@@ -111,9 +111,10 @@
 
 .section-nav {
   width: 750rpx;
-  height: 108rpx;
   background: #fff;
   margin-bottom: 20rpx;
+  padding:5px;
+
 }
 
 .section-nav .t {
@@ -138,13 +139,13 @@
   float: left;
   display: flex;
   align-items: center;
-  width: 600rpx;
-  height: 108rpx;
   overflow: hidden;
   line-height: 108rpx;
   font-size: 29rpx;
   color: #999;
-  margin-left: 31.25rpx;
+  width: 700rpx;
+  height: 70rpx;
+  /* margin-left: 31.25rpx; */
 }
 
 .section-act .label {
@@ -158,13 +159,23 @@
   border-radius: 3px;
   height: 37rpx;
   width: auto;
-  color: #f48f18;
+  color: #999;
   overflow: hidden;
-  border: 1px solid #f48f18;
+  border: 1px solid #999;
   font-size: 25rpx;
   margin: 0 10rpx;
 }
 
+.section-act  .y{
+    color: #f48f18;
+  border: 1px solid #f48f18;
+}
+
+.section-act  .r{
+    color: #f94b4b;
+  border: 1px solid #f94b4b;
+}
+
 .section-act .text {
   display: flex;
   align-items: center;
@@ -790,16 +801,19 @@
   align-items: center;
   font-size: 25rpx;
   color: #666;
+  overflow: hidden;
 }
 
 .location-time .icon.location {
   background: url(https://i.postimg.cc/Hkf6dJzv/placeholder-2.png) 0 center no-repeat;
   background-size: 25rpx;
+  /* width:370rpx; */
 }
 
 .location-time .icon.time {
   background: url(https://i.postimg.cc/nrck0qVr/clock.png) 0 center no-repeat;
   background-size: 25rpx;
+  /* width: 330rpx; */
 }
 
 .location-time {
@@ -811,6 +825,7 @@
   flex-flow: row nowrap;
   align-items: center;
   justify-content: space-between;
+  overflow: hidden;
 }
 
 .seller-avatar {
@@ -895,24 +910,21 @@
 }
 
 .attr-pop-box .attr-pop .content {
-  
   border: 1rpx solid #eee;
   border-radius: 20rpx;
   padding: 10rpx;
   background: #eee;
-  overflow:hidden;
-  height:65rpx;
-
+  overflow: hidden;
+  height: 65rpx;
 }
-.attr-pop-box .attr-pop input {
-display:block;
-height:1.4rem;
-text-overflow:clip;
-overflow:hidden;
-white-space:nowrap;
-font-family:UICTFontTextStyleBody;
-min-height:1.4rem;
-margin-bottom: 40rpx;
-
 
+.attr-pop-box .attr-pop input {
+  display: block;
+  height: 1.4rem;
+  text-overflow: clip;
+  overflow: hidden;
+  white-space: nowrap;
+  font-family: UICTFontTextStyleBody;
+  min-height: 1.4rem;
+  margin-bottom: 40rpx;
 }