反馈修改-0808

static-project
Lee-1203 2022-08-08 18:55:27 +08:00
parent a3c5e79aa7
commit cb5f4ecf6b
8 changed files with 62 additions and 169 deletions

View File

@ -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>

View File

@ -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

View File

@ -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({

View File

@ -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();

View File

@ -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="">

View File

@ -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 = [];

View File

@ -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() {

BIN
static/public/xdd-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB