反馈修改-0808
parent
a3c5e79aa7
commit
cb5f4ecf6b
|
@ -1,20 +1,15 @@
|
|||
<template>
|
||||
<view class="pad-x120">
|
||||
<view class="slide-box mar-x20 animated" v-for="(item, index) in listData" :key="index" :class="item.ifExit ? 'fadeIn' : 'fadeOutDown'" :style="{display: item.ifShow ? 'flex' : 'none'}">
|
||||
<view class="slide-list"
|
||||
@touchstart="touchStart($event, index)"
|
||||
@touchend="touchEnd($event, index)"
|
||||
@touchmove="touchMove($event, index)"
|
||||
@tap="recover(index)"
|
||||
:style="{ transform: 'translate3d(' + item.slide_x + 'px, 0, 0)' }">
|
||||
<view class="now-message-info" :style="{ width: windowWidth + 'px' }" @click="clickItemMethod(item)">
|
||||
<view class="slide-list" :style="{ transform: 'translate3d(' + item.slide_x + 'px, 0, 0)' }">
|
||||
<view class="now-message-info" :style="{ width: windowWidth + 'px' }">
|
||||
<!-- <view class="mo-item flexs" @tap.stop="chooseEv(index)" :class="item.ifcheck ? 'active-item' : ''"></view> -->
|
||||
<label class="radio"><radio :checked="item.ifcheck" @tap.stop="chooseEv(index)" color="#ff3673" style="transform: scale(.8);"/></label>
|
||||
<view class="shopp-img imgH mar-y20 mar-z10" @tap="goDetail(item.spuId)">
|
||||
<image class="shopp-img imgH width100" :src="item.image" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="imgH disjb fc fon24 width100">
|
||||
<view class="">
|
||||
<view class="" @tap="goDetail(item.spuId)">
|
||||
<view class="fon28 bold clips2">{{item.title}}</view>
|
||||
<view class="clips2 line-h40">单位:{{item.content}}</view>
|
||||
</view>
|
||||
|
@ -33,12 +28,6 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="group-btn">
|
||||
<view class="btn-div" v-for="(value, key) in button" :key="key"
|
||||
@tap.stop="clickMethod(item, value, index,key)" :style="{background: value.background}">
|
||||
{{value.title}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 全选 -->
|
||||
|
@ -89,10 +78,6 @@
|
|||
];
|
||||
}
|
||||
},
|
||||
customB:{
|
||||
type:String,
|
||||
default:'0'
|
||||
},
|
||||
skuId:{
|
||||
type:String,
|
||||
default:0
|
||||
|
@ -305,138 +290,6 @@
|
|||
// 如果当前输入框的值不等于0或空,并且当前输入框的值大于最大值,当前商品的数量 = 最大值, 否则为当前输入框输入的值
|
||||
this.listData[index].num = currentNum ? currentNum > this.maxNum ? this.maxNum : currentNum : this.originalNum;
|
||||
},
|
||||
clone(data) {
|
||||
const type = typeof data
|
||||
let obj;
|
||||
if (type === 'array') {
|
||||
obj = [];
|
||||
} else if (type === 'object') {
|
||||
obj = {};
|
||||
} else {
|
||||
// 不再具有下一层次
|
||||
return data;
|
||||
}
|
||||
if (type === 'array') {
|
||||
for (let i = 0, len = data.length; i < len; i++) {
|
||||
obj.push(this.clone(data[i]));
|
||||
}
|
||||
} else if (type === 'object') {
|
||||
// 对原型上的方法也拷贝了....
|
||||
for (const key in data) {
|
||||
obj[key] = this.clone(data[key]);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
// 滑动开始
|
||||
touchStart(e, index) {
|
||||
if (this.itemIndex == index) {
|
||||
this.itemIndex = index
|
||||
}
|
||||
//记录手指放上去的时间
|
||||
this.startTime = e.timeStamp;
|
||||
//记录滑块的初始位置
|
||||
this.start_slide_x = this.listData[index].slide_x;
|
||||
// 按钮宽度
|
||||
//#ifdef MP-WEIXIN
|
||||
uni.createSelectorQuery().in(this).selectAll('.group-btn').boundingClientRect(res => {
|
||||
if (res != null) {
|
||||
this.btnWidth = res[index].width * -1;
|
||||
}
|
||||
}).exec();
|
||||
//#endif
|
||||
//#ifdef H5 || APP-PLUS
|
||||
uni.createSelectorQuery()
|
||||
.selectAll('.group-btn')
|
||||
.boundingClientRect()
|
||||
.exec(res => {
|
||||
if (res[0] != null) {
|
||||
this.btnWidth = res[0][index].width * -1;
|
||||
}
|
||||
});
|
||||
//#endif
|
||||
// 记录上一次开始时手指所处位置
|
||||
this.startX = e.touches[0].pageX;
|
||||
// 记录上一次手指位置
|
||||
this.lastX = this.startX;
|
||||
//初始化非当前滑动消息列的位置
|
||||
for (var i in this.listData) {
|
||||
if (index != i) {
|
||||
this.listData[i].slide_x = 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
// 滑动中
|
||||
touchMove(e, index) {
|
||||
const endX = e.touches[0].pageX;
|
||||
const distance = endX - this.lastX;
|
||||
// 预测滑块所处位置
|
||||
const duang = this.listData[index].slide_x + distance;
|
||||
// 如果在可行区域内
|
||||
if (duang <= 0 && duang >= this.btnWidth) {
|
||||
this.listData[index].slide_x = duang;
|
||||
}
|
||||
// 此处手指所处位置将成为下次手指移动时的上一次位置
|
||||
this.lastX = endX;
|
||||
},
|
||||
// 滑动结束
|
||||
touchEnd(e, index) {
|
||||
let distance = 10;
|
||||
const endTime = e.timeStamp;
|
||||
const x_end_distance = this.startX - this.lastX;
|
||||
if (Math.abs(endTime - this.startTime) > 200) {
|
||||
distance = this.btnWidth / -2;
|
||||
}
|
||||
// 判断手指最终位置与手指开始位置的位置差距
|
||||
if (x_end_distance > distance) {
|
||||
this.listData[index].slide_x = this.btnWidth;
|
||||
} else if (x_end_distance < distance * -1) {
|
||||
this.listData[index].slide_x = 0;
|
||||
} else {
|
||||
this.listData[index].slide_x = this.start_slide_x;
|
||||
}
|
||||
},
|
||||
// 点击回复原状
|
||||
recover(index) {
|
||||
this.listData[index].slide_x = 0;
|
||||
},
|
||||
/**
|
||||
* 点击按钮触发事件
|
||||
* @param {Object} item 列表数据
|
||||
* @param {Object} buttonItem 按钮数据
|
||||
* @param {Object} index 列表数据key
|
||||
*/
|
||||
clickMethod(item, buttonItem, index,key) {
|
||||
// this.$emit("change", item, buttonItem, index);
|
||||
// if(key) {
|
||||
// 进入删除
|
||||
// 修改为不存在的商品
|
||||
this.$requst.post('/api/order/shopping-cart-del',{id:this.listData[index].id}).then(res=>{
|
||||
if(res.code==0){
|
||||
this.listData[index].ifExit = false;
|
||||
// 修改该商品不被选中
|
||||
this.listData[index].ifcheck = false;
|
||||
setTimeout(()=>{
|
||||
// 隐藏该商品
|
||||
this.listData[index].ifShow = false;
|
||||
},1000)
|
||||
setTimeout(()=>{
|
||||
// 重构数组列表,去除不存在的商品
|
||||
this.listData = this.listData.filter(item=>item.ifExit==true);
|
||||
},1000)
|
||||
getCartNum();
|
||||
}
|
||||
})
|
||||
// }
|
||||
},
|
||||
/**
|
||||
* 点击按钮触发事件
|
||||
* @param {Object} item 列表数据
|
||||
*/
|
||||
clickItemMethod(item) {
|
||||
this.$emit("click", item)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name" : "app适配微信小程序",
|
||||
"name" : "喜兜兜",
|
||||
"appid" : "__UNI__768F35C",
|
||||
"description" : "这是一款基于uniapp开发的app和微信小程序的模板框架",
|
||||
"versionName" : "1.0.0",
|
||||
|
@ -69,7 +69,7 @@
|
|||
/* 快应用特有相关 */
|
||||
"mp-weixin" : {
|
||||
/* 小程序特有相关 */
|
||||
"appid" : "wxa02e44170bc722cd",
|
||||
"appid" : "wx9cfa3ee7718b714e",
|
||||
"setting" : {
|
||||
"urlCheck" : true,
|
||||
"es6" : true
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<template>
|
||||
<view>
|
||||
<view v-if="isLoding">
|
||||
<status-container :ifReturn="false" titlet="分类">
|
||||
<view slot="content" style="margin: -20rpx -20rpx 0 -20rpx;">
|
||||
<view class="dis">
|
||||
<view class="cate-left-box">
|
||||
<scroll-view scroll-y :style="{height: scrollHeight +'px'}" class="bacf">
|
||||
<scroll-view scroll-y :style="{height: scrollHeight +'px'}" class="bacf" :scroll-top="tabsScrollTop" @scroll="scroll">
|
||||
<view>
|
||||
<view class="flexs clips1 pad-z20 fon24"
|
||||
@tap="chooseCate(index,item.id)" :style="{backgroundColor: current==index ? '#ff3673' : '#FFFFFF',color: current==index ? '#FFFFFF' : '#000000'}"
|
||||
@tap="chooseCate(index)" :style="{backgroundColor: current==index ? '#ff3673' : '#FFFFFF',color: current==index ? '#FFFFFF' : '#000000'}"
|
||||
v-for="(item,index) in cateList" :key="index" style="min-width: 160rpx;height: 86rpx;line-height: 86rpx;box-sizing: border-box;" >{{item.title}}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
@ -79,6 +79,8 @@
|
|||
topList:[],
|
||||
heightData: 0,
|
||||
scroll:true,
|
||||
cateCurrent:0,
|
||||
isLoding:false,
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
|
@ -89,15 +91,24 @@
|
|||
onLoad(op) {
|
||||
this.scrollHeight = this.scrollHeight - this.footHeight;
|
||||
if(op.index) {
|
||||
this.current = op.index;
|
||||
this.cateCurrent = op.index;
|
||||
}
|
||||
this.checkShopCate();
|
||||
},
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title:'喜兜兜-分类',
|
||||
path:uni.getStorageSync('page-path-options'),
|
||||
imageUrl:'/static/public/xdd-logo.png'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 查询商品列表
|
||||
checkShopList(){
|
||||
uni.showLoading({
|
||||
title:'加载中'
|
||||
})
|
||||
for(let i=0;i<this.cateList.length;i++){
|
||||
console.log(i)
|
||||
this.ifLoading = true;
|
||||
let params = {
|
||||
category_id:this.cateList[i].id
|
||||
|
@ -118,6 +129,8 @@
|
|||
})
|
||||
this.dataList[i] = newArr;
|
||||
if(i == this.cateList.length-1){
|
||||
this.current = this.cateCurrent;
|
||||
this.doms = 'product'+this.current;
|
||||
setTimeout(()=>{
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('.cate-title').boundingClientRect(data => {
|
||||
|
@ -126,6 +139,8 @@
|
|||
},200)
|
||||
this.getNodesInfo();
|
||||
this.ifLoading = false;
|
||||
uni.hideLoading();
|
||||
this.isLoding =true;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -157,13 +172,12 @@
|
|||
},
|
||||
|
||||
// 一级分类选择
|
||||
chooseCate(index,id) {
|
||||
chooseCate(index) {
|
||||
if(this.scroll){
|
||||
if(this.current !== index){
|
||||
this.scroll =false;
|
||||
this.current =index
|
||||
this.doms = 'product'+index
|
||||
console.log(index,11111)
|
||||
}
|
||||
this.scroll = true;
|
||||
}
|
||||
|
@ -174,11 +188,10 @@
|
|||
this.scroll =false;
|
||||
let scrollTop = e.target.scrollTop
|
||||
for(let i =0;i<this.topList.length;i++){
|
||||
let h1 = this.topList[i]
|
||||
let h2 = this.topList[i+1]
|
||||
if(scrollTop>=h1&&scrollTop<h2){
|
||||
let h1 = this.topList[i];
|
||||
let h2 = this.topList[i+1];
|
||||
if(scrollTop>=h1&&scrollTop<h2-5){
|
||||
this.current = i
|
||||
console.log(i,22222)
|
||||
}
|
||||
}
|
||||
this.scroll =true;
|
||||
|
@ -200,6 +213,27 @@
|
|||
},200)
|
||||
},
|
||||
|
||||
|
||||
// 计算顶部距离
|
||||
setTop(){
|
||||
this.getElementData('#index-cate-bg', (res) => {
|
||||
let el = res[0];
|
||||
this.scrollTop = el.top;
|
||||
if(this.scrollTop==this.statusHeight+35){
|
||||
this.isShow = false;
|
||||
}else{
|
||||
this.isShow = true;
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 获取DOM距离
|
||||
getElementData(el, callback) {
|
||||
uni.createSelectorQuery().in(this).selectAll(el).boundingClientRect().exec((data) => {
|
||||
callback(data[0]);
|
||||
});
|
||||
},
|
||||
|
||||
// 跳转详情页
|
||||
goDetail(id) {
|
||||
uni.navigateTo({
|
||||
|
|
|
@ -70,7 +70,11 @@
|
|||
}),
|
||||
},
|
||||
onShareAppMessage() {
|
||||
|
||||
return {
|
||||
title:'喜兜兜',
|
||||
path:uni.getStorageSync('page-path-options'),
|
||||
imageUrl:'/static/public/xdd-logo.png'
|
||||
}
|
||||
},
|
||||
onReachBottom(e) {
|
||||
this.$refs.listhome.moreEv();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<view class="bacf radius30 pad-sx30 pad-zy40 fon30 mar-x25">
|
||||
<view class="">订单信息</view>
|
||||
<view class="disjb bbot pad-sx30" v-for="(item,index) in orderDetail.skus" :key="index">
|
||||
<image class="mar-y30 flexs radius30" src="https://s6.jpg.cm/2022/05/06/Lx4T45.jpg" mode="" style="width: 210rpx;height: 210rpx;"></image>
|
||||
<image class="mar-y30 flexs radius30" :src="item.sku_cover" mode="widthFix" style="width: 210rpx;height: 210rpx;"></image>
|
||||
<view class="width100 disjb fc line-h40" style="height: 210rpx;">
|
||||
<view class="clips2 fon24">{{item.spu_name}} </view>
|
||||
<view class="">
|
||||
|
|
|
@ -67,6 +67,8 @@
|
|||
methods: {
|
||||
goSearch(){
|
||||
this.ifResult = true;
|
||||
// 列表查询
|
||||
this.getList()
|
||||
},
|
||||
// 列表查询
|
||||
getList(){
|
||||
|
@ -76,7 +78,7 @@
|
|||
page:this.page,
|
||||
size:this.size
|
||||
}
|
||||
this.$requst.post('/api/spu/home',params).then(res=>{
|
||||
this.$requst.post('/api/spu/list',params).then(res=>{
|
||||
if(res.code==0) {
|
||||
this.total = res.data.total;
|
||||
if(this.page==1) this.dataList = [];
|
||||
|
|
|
@ -47,9 +47,9 @@
|
|||
},
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title:'',
|
||||
path:`/pagesB/shop-detail/shop-detail?id=${this.shopObj.id}`,
|
||||
imageUrl:''
|
||||
title:this.shopObj.name,
|
||||
path:uni.getStorageSync('page-path-options'),
|
||||
imageUrl:this.bannerList[0].imgSrc
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
Loading…
Reference in New Issue