Skip to content

Commit

Permalink
升级至V1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gooking committed Sep 6, 2017
1 parent c5a92f0 commit 7cc5cbc
Show file tree
Hide file tree
Showing 11 changed files with 153 additions and 66 deletions.
9 changes: 6 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//app.js
App({
onLaunch: function () {
console.log('test');
var that = this;
// 获取商城名称
wx.request({
Expand All @@ -10,7 +9,11 @@ App({
key: 'mallName'
},
success: function(res) {
wx.setStorageSync('mallName', res.data.data.value);
if (res.data.code == 0) {
wx.setStorageSync('mallName', res.data.data.value);
} else {
wx.setStorageSync('mallName', "系统参数 mallName 未设置");
}
}
})
this.login();
Expand Down Expand Up @@ -88,6 +91,6 @@ App({
globalData:{
userInfo:null,
subDomain: "mall",
version: "1.4.0"
version: "1.5.0"
}
})
21 changes: 18 additions & 3 deletions pages/goods-details/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ Page({
})
},
onLoad: function (e) {
console.log('onLoad');
var that = this;
// 获取购物车数据
wx.getStorage({
key: 'shopCarInfo',
success: function(res) {
console.log(res.data)
that.setData({
shopCarInfo:res.data,
shopNum:res.data.shopNum
Expand Down Expand Up @@ -74,7 +72,7 @@ Page({
WxParse.wxParse('article', 'html', res.data.data.content, that, 5);
}
})

this.reputation(e.id);
},
goShopCar: function () {
wx.reLaunch({
Expand Down Expand Up @@ -394,5 +392,22 @@ Page({
// 转发失败
}
}
},
reputation: function (goodsId) {
var that = this;
wx.request({
url: 'https://api.it120.cc/' + app.globalData.subDomain + '/shop/goods/reputation',
data: {
goodsId: goodsId
},
success: function (res) {
if (res.data.code == 0) {
console.log(res.data.data);
that.setData({
reputation: res.data.data
});
}
}
})
}
})
23 changes: 19 additions & 4 deletions pages/goods-details/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<view class="swiper-container">
<swiper class="swiper_box"
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" bindchange="swiperchange">
<block wx:for="{{goodsDetail.pics}}">
<block wx:for="{{goodsDetail.pics}}" wx:key="id">
<swiper-item>
<image src="{{item.pic}}" class="slide-image" width="355" height="150"/>
</swiper-item>
Expand All @@ -17,7 +17,9 @@
</view>
<view class="goods-info">
<view class="goods-title">{{goodsDetail.basicInfo.name}}</view>
<view class="goods-price">¥ {{selectSizePrice}}</view>
<view class="goods-price" style="padding-left:35rpx;">¥ {{selectSizePrice}}</view>
<view class="goods-price" style="color:#999;font-size:24rpx;">购买{{goodsDetail.basicInfo.numberOrders}}次</view>
<view class="goods-price" style="color:#999;font-size:24rpx;">共收到 {{goodsDetail.basicInfo.numberGoodReputation}} 次好评</view>
</view>
<view wx:if="{{hasMoreSelect}}" class="row-arrow" bindtap="bindGuiGeTap">
{{selectSize}}
Expand All @@ -28,6 +30,19 @@
<template is="wxParse" data="{{wxParseData:article.nodes}}"/>
</view>
</view>
<view class="goods-des-info" style="margin-top:35rpx;" wx:if="{{reputation}}">
<view class="label-title" style="border-bottom:1px solid #eee;">大家评价<text style="color:red">({{reputation.length}})</text></view>
<view class="goods-text" style="margin-top:15rpx;" wx:for="{{reputation}}" wx:key="id">
<view style="width:100rpx;float:left;">
<image style="width: 100rpx; height: 100rpx;" src="{{item.user.avatarUrl}}"></image>
<view style="text-align:center;width:100rpx;">{{item.goods.goodReputationStr}}</view>
</view>
<view style="width:550rpx;float:left;margin-left:35rpx;border-bottom:1px solid #eee;">
<view>{{item.goods.goodReputationRemark}}</view>
<view style="color: #B0B0B0;font-size:24rpx;">{{item.goods.dateReputation}} {{item.goods.property}}</view>
</view>
</view>
</view>
<view class="footer-box">
<view class="contact">
<contact-button style="opacity:0;position:absolute;" type="default-dark" session-from="weapp" size="27"></contact-button>
Expand All @@ -54,10 +69,10 @@
<view class="pop-goods-close" bindtap="closePopupTap"></view>
</view>
<view class="size-label-box">
<block wx:for="{{goodsDetail.properties}}" wx:for-item="property" wx:for-index="idx">
<block wx:for="{{goodsDetail.properties}}" wx:for-item="property" wx:for-index="idx" wx:key="id">
<view class="label">{{property.name}}</view>
<view class="label-item-box">
<view class="label-item {{item.active ? 'active' : '' }}" wx:for="{{property.childsCurGoods}}" bindtap="labelItemTap" data-propertyindex="{{idx}}" data-propertyid="{{property.id}}" data-propertyname="{{property.name}}" data-propertychildindex="{{index}}" data-propertychildid="{{item.id}}" data-propertychildname="{{item.name}}">
<view class="label-item {{item.active ? 'active' : '' }}" wx:for="{{property.childsCurGoods}}" wx:key="id" bindtap="labelItemTap" data-propertyindex="{{idx}}" data-propertyid="{{property.id}}" data-propertyname="{{property.name}}" data-propertychildindex="{{index}}" data-propertychildid="{{item.id}}" data-propertychildname="{{item.name}}">
{{item.name}}
</view>
</view>
Expand Down
3 changes: 2 additions & 1 deletion pages/goods-details/index.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ swiper-item image {
}
.goods-info .goods-price{
box-sizing:border-box;
padding: 0 35rpx;
color:#e64340;
font-size: 28rpx;
font-weight: bold;
width: 30%;
float:left;
}
.row-arrow{
width: 100%;
Expand Down
23 changes: 16 additions & 7 deletions pages/index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ Page({
// console.log('scrollTop:'+scrollTop)
},
onLoad: function () {
console.log('onLoad')
var that = this
wx.setNavigationBarTitle({
title: wx.getStorageSync('mallName')
Expand All @@ -76,22 +75,32 @@ Page({
})
*/
wx.request({
url: 'https://api.it120.cc/'+ app.globalData.subDomain +'/banner/list',
url: 'https://api.it120.cc/' + app.globalData.subDomain + '/banner/list',
data: {
key: 'mallName'
},
success: function(res) {
that.setData({
banners: res.data.data
});
if (res.data.code == 404) {
wx.showModal({
title: '提示',
content: '请在后台添加 banner 轮播图片',
showCancel: false
})
} else {
that.setData({
banners: res.data.data
});
}
}
})
wx.request({
url: 'https://api.it120.cc/'+ app.globalData.subDomain +'/shop/goods/category/all',
success: function(res) {
var categories = [{id:0, name:"全部"}];
for(var i=0;i<res.data.data.length;i++){
categories.push(res.data.data[i]);
if (res.data.code == 0) {
for (var i = 0; i < res.data.data.length; i++) {
categories.push(res.data.data[i]);
}
}
that.setData({
categories:categories,
Expand Down
6 changes: 3 additions & 3 deletions pages/index/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<view class="swiper-container">
<swiper class="swiper_box"
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" bindchange="swiperchange">
<block wx:for="{{banners}}">
<block wx:for="{{banners}}" wx:key="id">
<swiper-item>
<image bindtap="tapBanner" data-id="{{item.businessId}}" src="{{item.picUrl}}" class="slide-image" width="750rpx" height="562.5rpx"/>
</swiper-item>
Expand All @@ -18,7 +18,7 @@
</view>
<view class="type-container">
<scroll-view class="type-navbar" scroll-x="true">
<view class="type-box" wx:for-items="{{categories}}">
<view class="type-box" wx:for-items="{{categories}}" wx:key="id">
<view id="{{item.id}}" class="type-navbar-item {{activeCategoryId == item.id ? 'type-item-on' : ''}}" bindtap="tabClick">
{{item.name}}
</view>
Expand All @@ -27,7 +27,7 @@
</view>
<view class="coupons" hidden="{{hasNoCoupons}}">
<scroll-view class="coupons-scroll" scroll-x="true">
<view class="coupons-item" wx:for-items="{{coupons}}" wx:for-index="idx" bindtap="gitCoupon" data-id="{{item.id}}">
<view class="coupons-item" wx:for-items="{{coupons}}" wx:for-index="idx" wx:key="id" bindtap="gitCoupon" data-id="{{item.id}}">
<view style="font-size: 35rpx"> ¥ {{item.moneyMax}}元 </view>
<view> {{item.name}} </view>
<view> 满 {{item.moneyHreshold}} 元使用 </view>
Expand Down
52 changes: 38 additions & 14 deletions pages/order-details/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,48 @@ Page({
orderId: orderId
},
success: (res) => {
wx.request({
url: 'https://api.it120.cc/' + app.globalData.subDomain + '/order/reputation',
data: {
token: app.globalData.token,
orderId: orderId,
reputation:2
},
success: (res) => {
wx.hideLoading();
if (res.data.code == 0) {
that.onShow();
}
}
})
if (res.data.code == 0) {
that.onShow();
}
}
})
}
}
})
},
submitReputation: function (e) {
var that = this;
var postJsonString = {};
postJsonString.token = app.globalData.token;
postJsonString.orderId = this.data.orderId;
var reputations = [];
var i = 0;
while (e.detail.value["orderGoodsId" + i]) {
var orderGoodsId = e.detail.value["orderGoodsId" + i];
var goodReputation = e.detail.value["goodReputation" + i];
var goodReputationRemark = e.detail.value["goodReputationRemark" + i];

var reputations_json = {};
reputations_json.id = orderGoodsId;
reputations_json.reputation = goodReputation;
reputations_json.remark = goodReputationRemark;

reputations.push(reputations_json);
i++;
}
postJsonString.reputations = reputations;
wx.showLoading();
wx.request({
url: 'https://api.it120.cc/' + app.globalData.subDomain + '/order/reputation',
data: {
postJsonString: postJsonString
},
success: (res) => {
wx.hideLoading();
if (res.data.code == 0) {
that.onShow();
}
}
})
}
})
34 changes: 26 additions & 8 deletions pages/order-details/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<image wx:elif="{{orderDetail.orderInfo.status==0}}" class="icon" src="/images/order-details/icon-ddfk.png"></image>
<image wx:elif="{{orderDetail.orderInfo.status==1}}" class="icon" src="/images/order-details/icon-ddfh.png"></image>
<image wx:elif="{{orderDetail.orderInfo.status==2}}" class="icon" src="/images/order-details/icon-ddsh.png"></image>
<image wx:elif="{{orderDetail.orderInfo.status==4}}" class="icon" src="/images/order-details/icon-jycg.png"></image>
<image wx:elif="{{orderDetail.orderInfo.status==3 || orderDetail.orderInfo.status==4}}" class="icon" src="/images/order-details/icon-jycg.png"></image>
</view>
<view class="right-text">
<view class="status red">{{orderDetail.orderInfo.statusStr}}</view>
Expand Down Expand Up @@ -53,7 +53,9 @@
</view>
<view class="goods-list">
<view class="list-title">商品信息</view>
<view class="a-goods" wx:for-items="{{orderDetail.goods}}" wx:key="{{index}}">
<form bindsubmit="submitReputation">
<block wx:for-items="{{orderDetail.goods}}" wx:key="{{index}}">
<view class="a-goods">
<view class="img-box">
<image src="{{item.pic}}" class="img" />
</view>
Expand All @@ -68,9 +70,31 @@
</view>
</view>
</view>
<view class="btn-row" wx:if="{{orderDetail.orderInfo.status==3}}">

<view class="section section_gap">
<view style="margin-top:35rpx;margin-bottom:35rpx;">评价:</view>
<radio-group name="goodReputation{{index}}">
<label style="margin-right:35rpx;"><radio value="2" checked/>好评</label>
<label style="margin-right:35rpx;"><radio value="1"/>中评</label>
<label style="margin-right:35rpx;"><radio value="0"/>差评</label>
</radio-group>
</view>
<view class="row-box" style="margin-top:35rpx">
<view class="row-label">备注</view>
<input name="orderGoodsId{{index}}" value="{{item.id}}" style="display:none;"/>
<textarea name="goodReputationRemark{{index}}" style="margin-top:35rpx;width:100%;" value="非常愉快的一次购物!" />
</view>
</view>
</block>
<view class="btn-row" wx:if="{{orderDetail.orderInfo.status==3}}">
<button class="confirm-btn" formType="submit">提交评价</button>
</view>
</form>
<view class="btn-row" wx:if="{{orderDetail.orderInfo.status==2}}">
<view class="confirm-btn" bindtap="confirmBtnTap" data-id="{{orderDetail.orderInfo.id}}">确认收货</view>
</view>

</view>
<view class="peisong-way" hidden="true">
<view class="row-box">
Expand Down Expand Up @@ -98,10 +122,4 @@
<view class="right-text">¥ {{orderDetail.orderInfo.amountReal}}</view>
</view>
</view>
<view class="jiesuan-box" hidden="true">
<view class="left-price">
<view class="total">合计:¥ {{orderDetail.orderInfo.amountReal}}</view>
</view>
<button class="to-pay-btn" formType="submit">提交订单</button>
</view>
</view>
Loading

0 comments on commit 7cc5cbc

Please sign in to comment.