Commit f92fd489 by 谢中龙

提交优化修改

parent 7e76240b
......@@ -109,6 +109,10 @@ Component({
wxService.openCard()
}
},
//图片加载失败
imgLoadError(e){
},
//处理PicNav
handlePicNav() {
const { picNav } = this.data;
......
......@@ -4,6 +4,7 @@
<view
wx:for="{{newPicNav}}"
wx:key="*this"
wx:for-index="idx"
wx:for-item="item"
class="nav-block"
>
......@@ -28,6 +29,8 @@
data-item="{{item}}"
bindload="imageLoad"
bindtap='preview'
binderror="imgLoadError"
data-index="{{idx}}"
mode="widthFix"
lazy-load
/>
......@@ -45,6 +48,8 @@
bindload="imageLoad"
bindtap='preview'
mode="widthFix"
binderror="imgLoadError"
data-index="{{idx}}"
lazy-load="true"
/>
</view>
......@@ -59,6 +64,8 @@
data-item="{{item}}"
bindload="imageLoad"
bindtap='preview'
binderror="imgLoadError"
data-index="{{idx}}"
mode="widthFix"
lazy-load
/>
......
......@@ -21,6 +21,15 @@ Component({
* 组件的方法列表
*/
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 @@
<view class="water-wrap">
<view class="left">
<block wx:for="{{imageData}}" wx:key="">
<template is="water-list" data="{{...item}}" wx:if="{{index%2==0}}"></template>
<block wx:for="{{imageData}}" wx:key="*this">
<template is="water-list" data="{{...item,index}}" wx:if="{{index%2==0}}"></template>
</block>
</view>
<view class="right">
<block wx:for="{{imageData}}" wx:key="">
<template is="water-list" data="{{...item}}" wx:if="{{index%2==1}}"></template>
<block wx:for="{{imageData}}" wx:key="*this">
<template is="water-list" data="{{...item,index}}" wx:if="{{index%2==1}}"></template>
</block>
</view>
</view>
<template name="water-list">
<navigator hover-class="none" url="/pages/productDetail/productDetail?id={{productId}}">
<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">{{productName}}</view>
</view>
......
......@@ -66,6 +66,8 @@
.pro-plus-price{
color: #cb3c3c;
font-size: 24rpx;
display: flex;
align-items: center;
}
.pro-member-price{
color: #333333;
......
......@@ -6,7 +6,7 @@
// 修改 BRANCH_ID 为对应的商户id
// 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
//2006 泰华 , wx40fec8944623c8b3
......@@ -24,7 +24,7 @@ const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门
//2992 山东盛联微商城 wx53dedc202ae0d0c2
//2002 巴黎贝甜 wx21968cb3a486d4ab
const BRANCH_ID = 1002
const BRANCH_ID = 3001
const isMall = true
// const needMock = '' //
......
......@@ -220,7 +220,6 @@ wxService.page({
},
// select 传过来
updateCoupon(e) {
console.log(e)
// faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券 3 定额券
if (!e.detail) {
this.setData({
......@@ -608,7 +607,8 @@ wxService.page({
defalutCouponId: defalutCouponId,
couponSettingId: couponSettingId,
orderInitPrice: data.amount,
totalGoodsPrice: this.data.totalGoodsPrice
totalGoodsPrice: this.data.totalGoodsPrice,
currentCoupon : 0,
}, () => {
// 实付款
this.setPayPrice()
......@@ -950,8 +950,6 @@ wxService.page({
}).finally(() => {
wx.hideLoading()
})
},
fail: function (err) {
console.log(err)
......
......@@ -74,6 +74,9 @@ wxService.page({
data.orderCanRefund = false;
}
}
else{
data.orderCanRefund = true;
}
}
else{
data.logistic = null;
......
......@@ -135,7 +135,7 @@
<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>
</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
class="btn btn-gray btn-lg"
data-id="{{detail.id}}"
......
......@@ -13,7 +13,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.8.2",
"appid": "wxac09792264c49b5c",
"appid": "wx313ec36b710125d4",
"projectname": "%E5%BE%AE%E5%95%86%E5%9F%8E",
"debugOptions": {
"hidedInDevtools": []
......
......@@ -39,18 +39,46 @@ wxService.page({
priceSort:false,
currentTab:'recommend',
proStyle:false,
tagId : null,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log('options', options)
if (options && options.id) {
let type = options.type;
//说明是从分类中过来的
if(!type){
if (options && options.id) {
this.setData({
'form.mallCategoryId': options.id
})
}
this.setData({
'form.mallCategoryId': options.id
'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;
if (memberId) {
let tentacleInfo = {
......@@ -63,11 +91,6 @@ wxService.page({
this.generatePointObject(tentacleInfo);
}
this.setData({
'form.sortType': this.data.currentTab
})
this.getProList();
},
/**
......@@ -79,7 +102,6 @@ wxService.page({
// 切换tab
switchTab(e){
console.log(e)
this.data.form.order = '';
this.setData({
currentTab: e.currentTarget.dataset.type,
......@@ -103,26 +125,36 @@ wxService.page({
//获取商品列表
getProList(refresh) {
if(!this.data.tagId){
this.getProductListByCategoryId(refresh);
}
else{
this.getProductListByTagId(refresh);
}
},
//获取商品列表
getProductListByCategoryId(refresh){
wx.showLoading({
title: '加载中'
});
let pageNo = this.data.pageNo,
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 => {
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.pageNo == 1 ? [...data.content] : [...this.data.proData, ...data.content],
proData: this.data.proData,
totalPages: data.totalPages,
totalElements: data.totalElements
})
}
if (refresh){
if (refresh) {
wx.showToast({
title: '数据已刷新',
});
......@@ -133,6 +165,46 @@ wxService.page({
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(){
......
<!--subPackage/page/pages/categoryPro/categoryPro.wxml-->
<view class="page-category-pro">
<view class="pro-nav-wrap">
<view class="pro-nav-wrap" wx:if="{{!tagId}}">
<view class="nav-list">
<block wx:for="{{navTab}}" wx:key="{{index}}">
<view class="nav-item {{currentTab == item.type ? 'nav-active' : ''}}"
......
......@@ -75,6 +75,8 @@ HandlerLink.prototype = {
return `${item.link.url}`
} else if (type == 9) {
return `${item.link.url}`
} else if (type == 10) {
return `${item.link.url}`
}
}
}
......@@ -147,7 +149,9 @@ HandlerLinkRow.prototype = {
} else if (type == 9) {
// return `id=${item.url}&name=${item.name}`
return `${item.url}`
}
} else if (type == 10) {
return `${item.url}`
}
}
}
......
......@@ -10,7 +10,6 @@ function currentLinkRouter(event, _this) {
//处理返回值是空对象时 导致跳转失败
if (Object.keys(curItemType.link).length > 0){
let currentClickType = app.globalData.commonFunc.getLink(curItemType.link.type, curItemType)
console.log(currentClickType)
if (curItemType.link.type == 1) {
// 触发父组件更新页面 外部小程序
} else if (curItemType.link.type == 2) {
......@@ -57,6 +56,8 @@ function currentLinkRouter(event, _this) {
wxService.router(`/pages/productDetail/productDetail?id=${currentClickType}`)
} else if (curItemType.link.type == 9) {
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{
......@@ -77,7 +78,9 @@ function currentLinkRouter(event, _this) {
else if (rowObj.type == 9) {
// 分类
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) {
let rowObj = typeof(curItemType.row) == "string" ? JSON.parse(curItemType.row) : curItemType.row
......@@ -97,7 +100,9 @@ function currentLinkRouter(event, _this) {
else if (rowObj.type == 9) {
// 分类
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