Browse Source

优化

master
ltlzx 3 years ago
parent
commit
7f9fc2d6a0
  1. 96
      pages/productDetails/index.vue
  2. 55
      pages/shippingCart/index.vue

96
pages/productDetails/index.vue

@ -21,7 +21,7 @@
<swiper class="swiper" @change="gridSwiper" :circular="true">
<swiper-item v-for="(item,index ) in goodsDate.gallery_list" :key="index">
<view class="swiper-item">
<image :src="item.img_url" class="swiper-item-image" mode=""></image>
<image :src="item.img_url" class="swiper-item-image" mode="" @click="clickImg(index)"></image>
<!-- <img src="" alt="" class="swiper-item-image"> -->
<!-- <image src="../../static/img/play.png" class="vedio_play" mode="" ></image> -->
</view>
@ -207,11 +207,13 @@
</view>
<view class="productImage">
<view class="productImage_title">Product lmage gallery</view>
<view class="productImage_image" v-html="goodsDate.goods_desc">
<!-- {{goodsDate.goods_desc}} -->
<!-- <image :src="goodsDate.goods_img" mode=""></image> -->
</view>
<template v-if="goodsDate.goods_desc">
<view class="productImage_title">Product lmage gallery</view>
<view class="productImage_image" v-html="goodsDate.goods_desc">
<!-- {{goodsDate.goods_desc}} -->
<!-- <image :src="goodsDate.goods_img" mode=""></image> -->
</view>
</template>
<view class="recommend recommend1" v-if="goodsDate.category_list">
<view class="recommend_title">Other options</view>
<scroll-view class="spike1 " scroll-x="true" :show-scrollbar="false">
@ -245,7 +247,7 @@
<text>US$314.00</text>
</view>
<view class="footer_right">
<button @click="addCart">ADD TO CART</button>
<button @click="isCart=true">ADD TO CART</button>
</view>
</view>
<view class="mask" @click="isCart=false,isSecurity=false" v-show="isCart || isSecurity"></view>
@ -284,7 +286,7 @@
<view class="addCard" v-show="isCart">
<image src="/static/img/close1.png" mode="" class="addCard_close"></image>
<scroll-view class="spike1 " scroll-x="true" :show-scrollbar="false">
<image :src="item.img_url" mode="" class="addCard_scroll" v-for="(item,index) in goodsDate.gallery_list" :key="index" ></image>
<image :src="item.img_url" mode="" class="addCard_scroll" v-for="(item,index) in goodsDate.gallery_list" :key="index" @click="clickImg(index)"></image>
</scroll-view>
<view class="addCard_body">
<view >{{goodsDate.goods_name}} </view>
@ -322,9 +324,9 @@
</view> -->
<view class="quantity">
<text>Quantity</text>
<uni-number-box background="#FFFFFF">1</uni-number-box>
<uni-number-box background="#FFFFFF" v-model="cartQuery.goods_number" :min="1"></uni-number-box>
</view>
<button>ADD TO CART</button>
<button @click="addCart">ADD TO CART</button>
</view>
</view>
</view>
@ -360,6 +362,7 @@
goods_attr_list:[
{goods_attr_id:''}
],
//
catQuery:{
_action:'getgoods',
cat:'',
@ -367,11 +370,55 @@
page_size:10
},
catList:[],
isReachBottom:true
isReachBottom:true,
//
cartQuery:{
_action:'addtocart',
goods_id:'',
goods_parent_id:0,
goods_number:1,
goods_attr_id:'',
goods_is_package:0
}
}
},
methods:{
//
addCart(){
if(this.goods_attr_list.length==0){
uni.showToast({
title:'Please select the product specification',
icon:'none'
})
return
}else{
let goods_attr_id=''
this.goods_attr_list.map(item=>{
goods_attr_id+=item.goods_attr_id+','
})
this.cartQuery.goods_attr_id=goods_attr_id.substring(0,goods_attr_id.lastIndexOf(','));
}
defaultRequest2(this.cartQuery).then(res=>{
console.info(res)
if(res.error==0){
uni.showToast({
title:'Successfully added',
icon:'none'
})
}
})
},
//
clickImg(index) {
wx.previewImage({
urls: this.info, //httpurl
current: index, // http
indicator:'number',
success: function(res) {},
fail: function(res) {},
complete: function(res) {},
})
},
//
goDetails(id){
uni.navigateTo({
@ -404,6 +451,7 @@
//
selectAttr(attr_id,goods_attr_id,index){
let data={attr_id:attr_id,goods_attr_id:goods_attr_id}
if(this.goods_attr_list[0].goods_attr_id=='')this.goods_attr_list=[]
if(this.goods_attr_list.length==0){
this.goods_attr_list.push(data)
}else{
@ -482,20 +530,23 @@
this.goodsDate=res.data
this.goodsDate.gallery_list.map(item=>{
item.content=''
this.info.push(item.img_url)
})
this.goodsDate.attr_list.map(item=>{
if(item.attr_name=="Color"){
this.colorNum=item.goods_attrs.length
}
})
if(this.goodsDate.attr_list){
this.goodsDate.attr_list.map(item=>{
if(item.attr_name=="Color"){
this.colorNum=item.goods_attrs.length
}
})
}else{
this.goods_attr_list=[]
}
this.catQuery.cat=res.data.cat_id
this.getCatList(0)
}
})
},
addCart(){
this.isCart=true
},
//
gridSwiper(e){
// if(e.detail.current==1){
@ -511,6 +562,7 @@
},
onLoad(e) {
this.query.goods_id=e.goods_id
this.cartQuery.goods_id=e.goods_id
this.getDate()
this.user_info=uni.getStorageSync('user_info')
if(this.user_info.isLogin){
@ -1200,7 +1252,7 @@
width: 100%;
min-height: 788rpx;
margin-bottom: 62rpx;
background-color: #999999;
// background-color: #999999;
image{
width: 100%;
@ -1210,7 +1262,7 @@
.productImage_image1{
width: 100%;
height: 532rpx;
background-color: #999999;
// background-color: #999999;
image{
width: 100%;
height: 100%;

55
pages/shippingCart/index.vue

@ -20,21 +20,24 @@
</view>
<view class="cart">
<view class="cart_content">
<view class="good_info" v-for="(item,index) in 3 " :key="index">
<image src="../../static/img/select2.png" mode="" class="cart_select"></image>
<view class="good_info" v-for="(item,index) in goods_list " :key="item.rec_id">
<image src="../../static/img/select1.png" mode="" class="cart_select" v-show="is_check==1"></image>
<image src="../../static/img/select2.png" mode="" class="cart_select" v-show="is_check==0"></image>
<view class="good_info_left ">
<view class="good_info_image" v-for="(item,index) in 1" :key="index"></view>
<view class="good_info_image">
<image :src="item.goods_thumb" mode=""></image>
</view>
<view class="left_info">
<view class="info_name">Adidas Yeezy Boost 350 V2 DazzlingBlue Black GY7164 Men's</view>
<view class="info_name">{{item.goods_name}}</view>
<view class="left_info_bottom">
<view class="info_lable">
<text>Multicolor;41</text>
<text>{{item.goods_attr}}</text>
<image src="/static/img/bottom.png" mode=""></image>
</view>
</view>
<view class="info_price">
<text>US$314.00</text>
<uni-number-box background="#FFFFFF">1</uni-number-box>
<text>US${{item.goods_price}}</text>
<uni-number-box background="#FFFFFF">{{item.goods_number}}</uni-number-box>
</view>
</view>
@ -101,13 +104,37 @@
</template>
<script>
import {defaultRequest2} from '../../api/index.js'
export default {
data() {
return {
isEmpty:false
isEmpty:false,
//
total:{},
//
goods_list:[],
// 1-2-3-
all_allno:2
}
},
methods:{
getList(){
let data={_action:'getcartgoods'}
defaultRequest2(data).then(res=>{
console.info(res)
if(res.error==0){
this.total=res.data.total
this.all_allno=res.data.all_allno
res.data.goods_list.map(item=>{
item.goods_attr=item.goods_attr.replace(/\n/,"");
console.info(item.goods_attr)
})
this.goods_list=res.data.goods_list
}
})
},
back(){
uni.switchTab({
url: '/pages/index/index'
@ -116,6 +143,7 @@
},
onShow() {
uni.hideTabBar()
this.getList()
},
onHide(){
uni.showTabBar()
@ -237,6 +265,10 @@
}
.good_info_image{
position: relative;
image{
width: 100%;
height: 100%;
}
.good_info_image_tips{
width: 117.33rpx;
height: 117.33rpx;
@ -276,6 +308,13 @@
}
.info_name{
width: 406.67rpx;
text-overflow: -o-ellipsis-lastline;
overflow: hidden; //
text-overflow: ellipsis; //
display: -webkit-box; //
-webkit-line-clamp: 2; //
line-clamp: 2;
-webkit-box-orient: vertical;
}
.delete{
width: 36rpx;

Loading…
Cancel
Save