Commit f92fd489 by 谢中龙

提交优化修改

parent 7e76240b
...@@ -109,6 +109,10 @@ Component({ ...@@ -109,6 +109,10 @@ Component({
wxService.openCard() wxService.openCard()
} }
}, },
//图片加载失败
imgLoadError(e){
},
//处理PicNav //处理PicNav
handlePicNav() { handlePicNav() {
const { picNav } = this.data; const { picNav } = this.data;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<view <view
wx:for="{{newPicNav}}" wx:for="{{newPicNav}}"
wx:key="*this" wx:key="*this"
wx:for-index="idx"
wx:for-item="item" wx:for-item="item"
class="nav-block" class="nav-block"
> >
...@@ -28,6 +29,8 @@ ...@@ -28,6 +29,8 @@
data-item="{{item}}" data-item="{{item}}"
bindload="imageLoad" bindload="imageLoad"
bindtap='preview' bindtap='preview'
binderror="imgLoadError"
data-index="{{idx}}"
mode="widthFix" mode="widthFix"
lazy-load lazy-load
/> />
...@@ -45,6 +48,8 @@ ...@@ -45,6 +48,8 @@
bindload="imageLoad" bindload="imageLoad"
bindtap='preview' bindtap='preview'
mode="widthFix" mode="widthFix"
binderror="imgLoadError"
data-index="{{idx}}"
lazy-load="true" lazy-load="true"
/> />
</view> </view>
...@@ -59,6 +64,8 @@ ...@@ -59,6 +64,8 @@
data-item="{{item}}" data-item="{{item}}"
bindload="imageLoad" bindload="imageLoad"
bindtap='preview' bindtap='preview'
binderror="imgLoadError"
data-index="{{idx}}"
mode="widthFix" mode="widthFix"
lazy-load lazy-load
/> />
......
...@@ -21,6 +21,15 @@ Component({ ...@@ -21,6 +21,15 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
//图片加载失败
imgLoadError(e){
console.log(e)
let defaultUrl = 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/product_defalut.jpg';
let index = e.currentTarget.dataset.index;
this.data.imageData[index].indexUrl = defaultUrl;
this.setData({
imageData: this.data.imageData
});
}
} }
}) })
...@@ -3,20 +3,24 @@ ...@@ -3,20 +3,24 @@
<view class="water-wrap"> <view class="water-wrap">
<view class="left"> <view class="left">
<block wx:for="{{imageData}}" wx:key=""> <block wx:for="{{imageData}}" wx:key="*this">
<template is="water-list" data="{{...item}}" wx:if="{{index%2==0}}"></template> <template is="water-list" data="{{...item,index}}" wx:if="{{index%2==0}}"></template>
</block> </block>
</view> </view>
<view class="right"> <view class="right">
<block wx:for="{{imageData}}" wx:key=""> <block wx:for="{{imageData}}" wx:key="*this">
<template is="water-list" data="{{...item}}" wx:if="{{index%2==1}}"></template> <template is="water-list" data="{{...item,index}}" wx:if="{{index%2==1}}"></template>
</block> </block>
</view> </view>
</view> </view>
<template name="water-list"> <template name="water-list">
<navigator hover-class="none" url="/pages/productDetail/productDetail?id={{productId}}"> <navigator hover-class="none" url="/pages/productDetail/productDetail?id={{productId}}">
<view class="item"> <view class="item">
<image class="item-img" src="{{indexUrl}}" mode="widthFix" lazy-load></image> <image class="item-img"
src="{{indexUrl}}"
mode="widthFix" lazy-load
binderror="imgLoadError"
data-index="{{index}}"></image>
<view class="item-title-box"> <view class="item-title-box">
<view class="item-title">{{productName}}</view> <view class="item-title">{{productName}}</view>
</view> </view>
......
...@@ -66,6 +66,8 @@ ...@@ -66,6 +66,8 @@
.pro-plus-price{ .pro-plus-price{
color: #cb3c3c; color: #cb3c3c;
font-size: 24rpx; font-size: 24rpx;
display: flex;
align-items: center;
} }
.pro-member-price{ .pro-member-price{
color: #333333; color: #333333;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// 修改 BRANCH_ID 为对应的商户id // 修改 BRANCH_ID 为对应的商户id
// app.js 中brandId 修改为对应 // app.js 中brandId 修改为对应
const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre const PROJECT_ENV = 'prod' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre
//仅生产环境时 配置 : //仅生产环境时 配置 :
//3001 3001 , wx313ec36b710125d4 //3001 3001 , wx313ec36b710125d4
//2006 泰华 , wx40fec8944623c8b3 //2006 泰华 , wx40fec8944623c8b3
...@@ -24,7 +24,7 @@ const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门 ...@@ -24,7 +24,7 @@ const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门
//2992 山东盛联微商城 wx53dedc202ae0d0c2 //2992 山东盛联微商城 wx53dedc202ae0d0c2
//2002 巴黎贝甜 wx21968cb3a486d4ab //2002 巴黎贝甜 wx21968cb3a486d4ab
const BRANCH_ID = 1002 const BRANCH_ID = 3001
const isMall = true const isMall = true
// const needMock = '' // // const needMock = '' //
......
...@@ -220,7 +220,6 @@ wxService.page({ ...@@ -220,7 +220,6 @@ wxService.page({
}, },
// select 传过来 // select 传过来
updateCoupon(e) { updateCoupon(e) {
console.log(e)
// faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券 3 定额券 // faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券 3 定额券
if (!e.detail) { if (!e.detail) {
this.setData({ this.setData({
...@@ -608,7 +607,8 @@ wxService.page({ ...@@ -608,7 +607,8 @@ wxService.page({
defalutCouponId: defalutCouponId, defalutCouponId: defalutCouponId,
couponSettingId: couponSettingId, couponSettingId: couponSettingId,
orderInitPrice: data.amount, orderInitPrice: data.amount,
totalGoodsPrice: this.data.totalGoodsPrice totalGoodsPrice: this.data.totalGoodsPrice,
currentCoupon : 0,
}, () => { }, () => {
// 实付款 // 实付款
this.setPayPrice() this.setPayPrice()
...@@ -950,8 +950,6 @@ wxService.page({ ...@@ -950,8 +950,6 @@ wxService.page({
}).finally(() => { }).finally(() => {
wx.hideLoading() wx.hideLoading()
}) })
}, },
fail: function (err) { fail: function (err) {
console.log(err) console.log(err)
......
...@@ -74,6 +74,9 @@ wxService.page({ ...@@ -74,6 +74,9 @@ wxService.page({
data.orderCanRefund = false; data.orderCanRefund = false;
} }
} }
else{
data.orderCanRefund = true;
}
} }
else{ else{
data.logistic = null; data.logistic = null;
......
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
<button class="btn btn-primary btn-lg" data-id="{{detail.id}}" bindtap="handelToPay">立即支付</button> <button class="btn btn-primary btn-lg" data-id="{{detail.id}}" bindtap="handelToPay">立即支付</button>
<button class="btn btn-lg btn-gray" data-id="{{detail.id}}" bindtap="handelCancelOrder">取消订单</button> <button class="btn btn-lg btn-gray" data-id="{{detail.id}}" bindtap="handelCancelOrder">取消订单</button>
</view> </view>
<view class="button-wrap" wx:if="{{detail.orderCanRefund || detail.status == 'D'}}"> <view class="button-wrap" wx:if="{{detail.orderCanRefund && (detail.status != 'N' || detail.status != 'C')}}">
<button <button
class="btn btn-gray btn-lg" class="btn btn-gray btn-lg"
data-id="{{detail.id}}" data-id="{{detail.id}}"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.8.2", "libVersion": "2.8.2",
"appid": "wxac09792264c49b5c", "appid": "wx313ec36b710125d4",
"projectname": "%E5%BE%AE%E5%95%86%E5%9F%8E", "projectname": "%E5%BE%AE%E5%95%86%E5%9F%8E",
"debugOptions": { "debugOptions": {
"hidedInDevtools": [] "hidedInDevtools": []
......
...@@ -39,18 +39,46 @@ wxService.page({ ...@@ -39,18 +39,46 @@ wxService.page({
priceSort:false, priceSort:false,
currentTab:'recommend', currentTab:'recommend',
proStyle:false, proStyle:false,
tagId : null,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
console.log('options', options) let type = options.type;
//说明是从分类中过来的
if(!type){
if (options && options.id) { if (options && options.id) {
this.setData({ this.setData({
'form.mallCategoryId': options.id 'form.mallCategoryId': options.id
}) })
} }
this.setData({
'form.sortType': this.data.currentTab
})
this.getProList();
}
//说明是从商品标签中来的
else if (type == 'pTag'){
this.data.tagId = options.id;
this.setData({
tagId: this.data.tagId,
'form.sortType': this.data.currentTab
},() => {
//根据tagid 获取商品列表
this.getProList();
});
}
//生成触点
this.getMemberIdAndGeneratorPoint(options);
},
//生成触点
getMemberIdAndGeneratorPoint(options){
let memberId = options.memberId; let memberId = options.memberId;
if (memberId) { if (memberId) {
let tentacleInfo = { let tentacleInfo = {
...@@ -63,11 +91,6 @@ wxService.page({ ...@@ -63,11 +91,6 @@ wxService.page({
this.generatePointObject(tentacleInfo); this.generatePointObject(tentacleInfo);
} }
this.setData({
'form.sortType': this.data.currentTab
})
this.getProList();
}, },
/** /**
...@@ -79,7 +102,6 @@ wxService.page({ ...@@ -79,7 +102,6 @@ wxService.page({
// 切换tab // 切换tab
switchTab(e){ switchTab(e){
console.log(e)
this.data.form.order = ''; this.data.form.order = '';
this.setData({ this.setData({
currentTab: e.currentTarget.dataset.type, currentTab: e.currentTarget.dataset.type,
...@@ -103,26 +125,36 @@ wxService.page({ ...@@ -103,26 +125,36 @@ wxService.page({
//获取商品列表 //获取商品列表
getProList(refresh) { getProList(refresh) {
if(!this.data.tagId){
this.getProductListByCategoryId(refresh);
}
else{
this.getProductListByTagId(refresh);
}
},
//获取商品列表
getProductListByCategoryId(refresh){
wx.showLoading({ wx.showLoading({
title: '加载中' title: '加载中'
}); });
let pageNo = this.data.pageNo, let pageNo = this.data.pageNo,
pageSize = this.data.pageSize; pageSize = this.data.pageSize;
console.log('pageNo----', pageNo)
console.log('pageSize----', pageSize)
console.log('form-----', this.data.form)
wxService.post(`/sale/product/buyer/listPageByCategoryId?pageNo=${pageNo}&pageSize=${pageSize}`, this.data.form).then(res => { wxService.post(`/sale/product/buyer/listPageByCategoryId?pageNo=${pageNo}&pageSize=${pageSize}`, this.data.form).then(res => {
const { result, data } = res.data const { result, data } = res.data
if (result == 0 && data.content) { if (result == 0 && data.content) {
wx.hideLoading() wx.hideLoading()
this.data.proData = this.data.pageNo == 1 ? [...data.content] : [...this.data.proData, ...data.content];
this.data.proData.forEach(item => {
item.indexUrl = item.indexUrl ? item.indexUrl : 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/product_defalut.jpg';
});
this.setData({ this.setData({
proData: this.data.pageNo == 1 ? [...data.content] : [...this.data.proData, ...data.content], proData: this.data.proData,
totalPages: data.totalPages, totalPages: data.totalPages,
totalElements: data.totalElements totalElements: data.totalElements
}) })
} }
if (refresh){ if (refresh) {
wx.showToast({ wx.showToast({
title: '数据已刷新', title: '数据已刷新',
}); });
...@@ -133,6 +165,46 @@ wxService.page({ ...@@ -133,6 +165,46 @@ wxService.page({
wx.hideLoading() wx.hideLoading()
}) })
}, },
//获取商品列表 通过tagid
getProductListByTagId(refresh){
wx.showLoading({
title: '加载中'
});
let pageNo = this.data.pageNo,
pageSize = this.data.pageSize;
wxService.post(`/sale/product/listPage?pageSize=${pageSize}&pageNo=${pageNo}`,{
productName: "",
showStockData: true,
categoryIds: [],
productTagIds : [this.data.tagId],
productStatus : 2,
// sortType : this.data.form.sortType,
// order : this.data.form.order,
}).then(res => {
const { result, data } = res.data
if (result == 0 && data.content) {
wx.hideLoading();
this.data.proData = this.data.pageNo == 1 ? [...data.content] : [...this.data.proData, ...data.content];
this.data.proData.forEach(item => {
item.indexUrl = item.indexUrl ? item.indexUrl : 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/product_defalut.jpg';
});
this.setData({
proData: this.data.proData,
totalPages: data.totalPages,
totalElements: data.totalElements
})
}
if(refresh){
wx.showToast({
title: '数据已刷新',
});
wx.stopPullDownRefresh();
}
}).finally(() => {
wx.hideLoading()
})
},
// 切换列表样式 // 切换列表样式
switchProStyle(){ switchProStyle(){
......
<!--subPackage/page/pages/categoryPro/categoryPro.wxml--> <!--subPackage/page/pages/categoryPro/categoryPro.wxml-->
<view class="page-category-pro"> <view class="page-category-pro">
<view class="pro-nav-wrap"> <view class="pro-nav-wrap" wx:if="{{!tagId}}">
<view class="nav-list"> <view class="nav-list">
<block wx:for="{{navTab}}" wx:key="{{index}}"> <block wx:for="{{navTab}}" wx:key="{{index}}">
<view class="nav-item {{currentTab == item.type ? 'nav-active' : ''}}" <view class="nav-item {{currentTab == item.type ? 'nav-active' : ''}}"
......
...@@ -75,6 +75,8 @@ HandlerLink.prototype = { ...@@ -75,6 +75,8 @@ HandlerLink.prototype = {
return `${item.link.url}` return `${item.link.url}`
} else if (type == 9) { } else if (type == 9) {
return `${item.link.url}` return `${item.link.url}`
} else if (type == 10) {
return `${item.link.url}`
} }
} }
} }
...@@ -147,6 +149,8 @@ HandlerLinkRow.prototype = { ...@@ -147,6 +149,8 @@ HandlerLinkRow.prototype = {
} else if (type == 9) { } else if (type == 9) {
// return `id=${item.url}&name=${item.name}` // return `id=${item.url}&name=${item.name}`
return `${item.url}` return `${item.url}`
} else if (type == 10) {
return `${item.url}`
} }
} }
} }
......
...@@ -10,7 +10,6 @@ function currentLinkRouter(event, _this) { ...@@ -10,7 +10,6 @@ function currentLinkRouter(event, _this) {
//处理返回值是空对象时 导致跳转失败 //处理返回值是空对象时 导致跳转失败
if (Object.keys(curItemType.link).length > 0){ if (Object.keys(curItemType.link).length > 0){
let currentClickType = app.globalData.commonFunc.getLink(curItemType.link.type, curItemType) let currentClickType = app.globalData.commonFunc.getLink(curItemType.link.type, curItemType)
console.log(currentClickType)
if (curItemType.link.type == 1) { if (curItemType.link.type == 1) {
// 触发父组件更新页面 外部小程序 // 触发父组件更新页面 外部小程序
} else if (curItemType.link.type == 2) { } else if (curItemType.link.type == 2) {
...@@ -57,6 +56,8 @@ function currentLinkRouter(event, _this) { ...@@ -57,6 +56,8 @@ function currentLinkRouter(event, _this) {
wxService.router(`/pages/productDetail/productDetail?id=${currentClickType}`) wxService.router(`/pages/productDetail/productDetail?id=${currentClickType}`)
} else if (curItemType.link.type == 9) { } else if (curItemType.link.type == 9) {
wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?id=${currentClickType}`) wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?id=${currentClickType}`)
} else if (curItemType.link.type == 10) {
wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?id=${currentClickType}&type=pTag`)
} }
} }
else{ else{
...@@ -77,6 +78,8 @@ function currentLinkRouter(event, _this) { ...@@ -77,6 +78,8 @@ function currentLinkRouter(event, _this) {
else if (rowObj.type == 9) { else if (rowObj.type == 9) {
// 分类 // 分类
wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?id=${currentClickRow}`) wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?id=${currentClickRow}`)
} else if (rowObj.type == 10) {
wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?id=${currentClickRow}&type=pTag`)
} }
} }
} else if (curItemType.row) { } else if (curItemType.row) {
...@@ -97,6 +100,8 @@ function currentLinkRouter(event, _this) { ...@@ -97,6 +100,8 @@ function currentLinkRouter(event, _this) {
else if (rowObj.type == 9) { else if (rowObj.type == 9) {
// 分类 // 分类
wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?id=${currentClickRow}`) wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?id=${currentClickRow}`)
} else if (rowObj.type == 10) {
wxService.router(`/subPackage/page/pages/categoryPro/categoryPro?id=${currentClickRow}&type=pTag`)
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment