Browse Source

设置默认地址、删除、修改,优化商品列表上拉加载、商品详情

master
ltlzx 4 years ago
parent
commit
df3980ca36
  1. 17
      api/index.js
  2. 10
      api/request.js
  3. 4
      common/common.scss
  4. 6
      pages.json
  5. 116
      pages/account/addAddress.vue
  6. 48
      pages/account/address.vue
  7. 16
      pages/account/myProfile.vue
  8. 42
      pages/category/productList.vue
  9. 269
      pages/productDetails/index.vue
  10. BIN
      static/img/select4.png

17
api/index.js

@ -9,8 +9,10 @@ export const defaultRequest =query=>{
errMsg:true, errMsg:true,
isCookies:false, isCookies:false,
isEncryption:false, isEncryption:false,
isLoad:true
}) })
} }
//默认请求地址 不显示错误信息 //默认请求地址 不显示错误信息
export const defaultRequest1 =query=>{ export const defaultRequest1 =query=>{
return httpRequest({ return httpRequest({
@ -20,6 +22,7 @@ export const defaultRequest1 =query=>{
errMsg:false, errMsg:false,
isCookies:false, isCookies:false,
isEncryption:false, isEncryption:false,
isLoad:true
}) })
} }
//默认请求地址 只用cookies请求数据 //默认请求地址 只用cookies请求数据
@ -31,6 +34,7 @@ export const defaultRequest2 =query=>{
errMsg:true, errMsg:true,
isCookies:true, isCookies:true,
isEncryption:false, isEncryption:false,
isLoad:true
}) })
} }
//默认请求地址 只用cookies请求数据 对立面的对象进行加密 //默认请求地址 只用cookies请求数据 对立面的对象进行加密
@ -42,5 +46,18 @@ export const defaultRequest3 =query=>{
errMsg:true, errMsg:true,
isCookies:true, isCookies:true,
isEncryption:true, isEncryption:true,
isLoad:true
})
}
//默认请求地址 不显示等待加载
export const defaultRequest4 =query=>{
return httpRequest({
url:'mapi/api_v2011.php?appcode=DOPE+',
method:'post',
data:query,
errMsg:true,
isCookies:false,
isEncryption:false,
isLoad:false
}) })
} }

10
api/request.js

@ -4,9 +4,12 @@ import Base64 from 'base-64';
import cryptoJS from "crypto-js" import cryptoJS from "crypto-js"
const httpRequest = (params) => { const httpRequest = (params) => {
uni.showLoading({ if(params.isLoad){
title: "努力加载中..." uni.showLoading({
}); title: "努力加载中..."
});
}
const json_data={ const json_data={
appcode:'DOPE+' ,//应用编码 appcode:'DOPE+' ,//应用编码
appchannel:'FXXXXHUAWEI' ,//应用发布渠道 appchannel:'FXXXXHUAWEI' ,//应用发布渠道
@ -20,7 +23,6 @@ const httpRequest = (params) => {
let data=Object.assign(json_data,params.data) let data=Object.assign(json_data,params.data)
console.info(data) console.info(data)
let consignee let consignee
console.info(params.isEncryption)
if(params.isEncryption){ if(params.isEncryption){
// console.info(JSON.parse(JSON.stringify(data.consignee))) // console.info(JSON.parse(JSON.stringify(data.consignee)))
consignee=encryption(JSON.parse(JSON.stringify(data.consignee))) consignee=encryption(JSON.parse(JSON.stringify(data.consignee)))

4
common/common.scss

@ -371,6 +371,10 @@
height:340rpx ; height:340rpx ;
background-color: #999999; background-color: #999999;
margin-bottom: 37.33rpx; margin-bottom: 37.33rpx;
image{
width: 100%;
height: 100%;
}
} }
.recommend_content_item_pric{ .recommend_content_item_pric{
font-size: 32rpx; font-size: 32rpx;

6
pages.json

@ -135,7 +135,8 @@
{ {
"path": "pages/account/pointsDetails", "path": "pages/account/pointsDetails",
"style": { "style": {
"titleNView":false "titleNView":false,
"enablePullDownRefresh":true
} }
}, },
{ {
@ -177,7 +178,8 @@
{ {
"path": "pages/category/productList", "path": "pages/category/productList",
"style": { "style": {
"titleNView":false "titleNView":false,
"enablePullDownRefresh":true
} }
}, },
{ {

116
pages/account/addAddress.vue

@ -44,7 +44,7 @@
</view> </view>
</view> </view>
<view class="info_item_input"> <view class="info_item_input">
<input type="text" v-model="query.consignee.address"> <input type="text" v-model="address">
</view> </view>
</view> </view>
<view class="address_info_item"> <view class="address_info_item">
@ -158,7 +158,7 @@
country:0, country:0,
province:0, province:0,
city:0, city:0,
district:1, district:0,
address:'', address:'',
zipcode:'', zipcode:'',
email:'', email:'',
@ -170,17 +170,83 @@
is_default:0 is_default:0
}, },
province:'', province:'',
city:'' city:'',
address:''
} }
}, },
methods:{ methods:{
// //
save(){ save(){
if(this.query.consignee.consignee==''){
uni.showToast({
icon:'none',
title:'Please fill Fall name'
})
return
}
if(this.query.consignee.mobile==''){
uni.showToast({
icon:'none',
title:'Please fill Phone Number'
})
return
}
if(this.address==''){
uni.showToast({
icon:'none',
title:'Please fill Stree adderss or P.O.Box'
})
return
}
if(this.query.consignee.sign_building==''){
uni.showToast({
icon:'none',
title:'Please fill Appartment,suite,unit,etc.'
})
return
}
if(!this.isSelect1){ if(!this.isSelect1){
this.query.consignee.address=this.city+this.query.consignee.address if(this.city==''){
uni.showToast({
icon:'none',
title:'Please fill in City/Town'
})
return
}
this.query.consignee.address=this.city+this.address
}else{
if(this.query.consignee.city==0){
uni.showToast({
icon:'none',
title:'Please Select City/Town'
})
return
}
} }
if(!this.isSelect){ if(!this.isSelect){
if(this.province==''){
uni.showToast({
icon:'none',
title:'Please fill in State/Province'
})
return
}
this.query.consignee.address=this.province+this.query.consignee.address this.query.consignee.address=this.province+this.query.consignee.address
}else{
if(this.query.consignee.province==0){
uni.showToast({
icon:'none',
title:'Please Select State/Province'
})
return
}
}
if(this.query.consignee.zipcode==''){
uni.showToast({
icon:'none',
title:'Please fill Zip code/Postcode/PLZ/Eircode'
})
return
} }
console.info(this.query) console.info(this.query)
defaultRequest3(this.query).then(res=>{ defaultRequest3(this.query).then(res=>{
@ -192,6 +258,7 @@
}) })
uni.navigateBack() uni.navigateBack()
} }
this.query.consignee.address=''
}) })
}, },
// //
@ -207,7 +274,7 @@
getCountry(){ getCountry(){
let data={_action:'getregions',parent_region_id:0} let data={_action:'getregions',parent_region_id:0}
defaultRequest2(data).then(res=>{ defaultRequest2(data).then(res=>{
console.info(res) // console.info(res)
if(res.error==0){ if(res.error==0){
this.countryList=res.data this.countryList=res.data
} }
@ -215,6 +282,12 @@
}, },
// //
bindPickerChange(e){ bindPickerChange(e){
if(this.index!=e.detail.value){
this.provinceText=''
this.cityText=''
this.query.consignee.city=0
this.query.consignee.province=0
}
this.index=e.detail.value this.index=e.detail.value
if(this.countryList[this.index].regions){ if(this.countryList[this.index].regions){
this.isSelect=true this.isSelect=true
@ -222,17 +295,18 @@
}else{ }else{
this.isSelect=false this.isSelect=false
this.isSelect1=false this.isSelect1=false
this.provinceText=''
this.cityText=''
} }
this.query.consignee.country=this.countryList[this.index].region_id this.query.consignee.country=this.countryList[this.index].region_id
this.countryText=this.countryList[this.index].region_name this.countryText=this.countryList[this.index].region_name
}, },
// //
bindPickerChange1(e){ bindPickerChange1(e){
console.info(e.detail.value) if(this.provinceIndex!=e.detail.value){
this.cityText=''
this.query.consignee.city=0
}
this.provinceIndex=e.detail.value this.provinceIndex=e.detail.value
if(this.provinceList[this.provinceIndex].regions){ if(this.provinceList[this.provinceIndex].regions){
this.isSelect1=true this.isSelect1=true
this.cityList=this.provinceList[this.provinceIndex].regions this.cityList=this.provinceList[this.provinceIndex].regions
@ -240,6 +314,7 @@
this.isSelect1=false this.isSelect1=false
this.cityText='' this.cityText=''
} }
this.query.consignee.province=this.provinceList[this.provinceIndex].region_id this.query.consignee.province=this.provinceList[this.provinceIndex].region_id
this.provinceText=this.provinceList[this.provinceIndex].region_name this.provinceText=this.provinceList[this.provinceIndex].region_name
}, },
@ -250,7 +325,28 @@
this.cityText=this.cityList[this.cityIndex].region_name this.cityText=this.cityList[this.cityIndex].region_name
} }
}, },
onLoad() { onLoad(e) {
console.info(e)
if(e.type==1){
e.data=JSON.parse(e.data)
this.query.consignee=e.data
this.address=this.query.consignee.address
if(e.data.default_address_id==e.data.address_id){
this.query.is_default=1
}
this.countryText=e.data.country_name
if(e.data.city!=0){
this.isSelect1=true
this.cityText=e.data.city_name
}else{
}
if(e.data.province!=0){
this.isSelect=true
this.provinceText=e.data.province_name
}
}
this.getCountry() this.getCountry()
} }
} }

48
pages/account/address.vue

@ -11,16 +11,17 @@
<view>{{item.sign_building}} </view> <view>{{item.sign_building}} </view>
<text>{{item.country_name}} {{item.province_name}} {{item.city_name}} {{item.address}} {{item.mobile}}</text> <text>{{item.country_name}} {{item.province_name}} {{item.city_name}} {{item.address}} {{item.mobile}}</text>
</view> </view>
<image src="../../static/img/update.png" mode=""></image> <image src="../../static/img/update.png" mode="" @click="updateAddress(item)"></image>
</view> </view>
</view> </view>
<view class="address_default"> <view class="address_default">
<view class="address_default_left"> <view class="address_default_left">
<image src="../../static/img/select2.png" mode=""></image> <image src="../../static/img/select4.png" mode="" v-if="item.default_address_id==item.address_id"></image>
<image src="../../static/img/select2.png" mode="" v-else @click="setDefault(item.address_id)"></image>
<text>Default address</text> <text>Default address</text>
</view> </view>
<text>Delete</text> <text @click="deleteAddress(item.address_id)">Delete</text>
</view> </view>
</view> </view>
@ -29,6 +30,10 @@
<button>ADD ADDRESS</button> <button>ADD ADDRESS</button>
</navigator> </navigator>
</view> </view>
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog type="error" cancelText="Close" confirmText="Delete" title="Tips" content="Whether to delete the address?"
@confirm="deleteAddress" ></uni-popup-dialog>
</uni-popup>
</view> </view>
</template> </template>
@ -37,10 +42,45 @@
export default { export default {
data() { data() {
return { return {
list:[] list:[],
address_id:''
} }
}, },
methods:{ methods:{
//
updateAddress(item){
uni.navigateTo({
url:'./addAddress?type=1&data='+JSON.stringify(item)
})
},
//
deleteAddress(id){
this.address_id=id
this.$refs.alertDialog.open()
},
dialogConfirm(){
let data={_action:'dropconsignee',address_id:this.address_id}
defaultRequest2(data).then(res=>{
console.info(res)
if(res.error==0){
uni.showToast({
icon:'none',
title:res.message
})
this.getList()
}
})
},
//
setDefault(id){
let data={_action:'setdefaultconsignee',address_id:id}
defaultRequest2(data).then(res=>{
console.info(res)
if(res.error==0){
this.getList()
}
})
},
getList(){ getList(){
let data={_action:'getconsignees'} let data={_action:'getconsignees'}
defaultRequest2(data).then(res=>{ defaultRequest2(data).then(res=>{

16
pages/account/myProfile.vue

@ -35,7 +35,7 @@
<view class="profile_item "> <view class="profile_item ">
<text>Ship to</text> <text>Ship to</text>
<view class="profile_item_right"> <view class="profile_item_right">
<text>United States</text> <text>{{addressDate.country_name || 'United States'}}</text>
<image src="../../static/img/right1.png" alt="" class="right_img"></image> <image src="../../static/img/right1.png" alt="" class="right_img"></image>
</view> </view>
</view> </view>
@ -57,10 +57,21 @@
query:{ query:{
_action:'updateinfo', _action:'updateinfo',
nickname:'' nickname:''
} },
addressDate:{}
} }
}, },
methods:{ methods:{
//
getDefaultAddress(){
let data={_action:'getdefaultconsignee'}
defaultRequest2(data).then(res=>{
console.info(res)
if(res.error==0){
this.addressDate=res.data
}
})
},
getUserInfo(){ getUserInfo(){
let data={_action:'getinfo'} let data={_action:'getinfo'}
defaultRequest2(data).then(res=>{ defaultRequest2(data).then(res=>{
@ -91,6 +102,7 @@
onLoad() { onLoad() {
this.user_info=uni.getStorageSync('user_info') this.user_info=uni.getStorageSync('user_info')
this.getUserInfo() this.getUserInfo()
this.getDefaultAddress()
} }
} }
</script> </script>

42
pages/category/productList.vue

@ -31,7 +31,7 @@
</view> </view>
<view class="pets_nav_image"> <view class="pets_nav_image">
<image src="/static/img/pets_nav.png" mode="" v-show="pets_index==0" @click="pets_index=1"></image> <image src="/static/img/pets_nav.png" mode="" v-show="pets_index==0" @click="pets_index=1,$refs.waterfallsFlowRef.refresh()"></image>
<image src="/static/img/pets_nav1.png" mode="" v-show="pets_index==1" @click="pets_index=0"></image> <image src="/static/img/pets_nav1.png" mode="" v-show="pets_index==1" @click="pets_index=0"></image>
</view> </view>
</view> </view>
@ -84,9 +84,12 @@
navWidth:"160rpx", navWidth:"160rpx",
query:{ query:{
_action:'getgoods', _action:'getgoods',
order_type:0 order_type:0,
page_index:1,
page_size:10
}, },
list:[] list:[],
isReachBottom:true
} }
}, },
methods:{ methods:{
@ -158,16 +161,30 @@
this.query.order_type=1 this.query.order_type=1
} }
} }
this.getList() this.getList(0)
}, },
getList(){ getList(type){
defaultRequest(this.query).then(res=>{ defaultRequest(this.query).then(res=>{
console.info(res) console.info(res)
if(res.error==0){ if(res.error==0){
this.list=res.data if(res.data){
if(type==0){
this.$refs.waterfallsFlowRef.refresh(); this.list=res.data
this.$refs.waterfallsFlowRef.refresh();
}else{
this.list=this.list.concat(res.data)
}
}else{
this.isReachBottom=false
uni.showToast({
title: 'No more data yet',
icon:'none'
})
this.query.page_index--
}
} }
uni.hideNavigationBarLoading();
}) })
} }
}, },
@ -177,8 +194,13 @@
}else{ }else{
this.query.keyword=e.keyword this.query.keyword=e.keyword
} }
this.getList() this.getList(0)
},
//
onReachBottom(){
if(!this.isReachBottom)return
this.query.page_index++
this.getList(1)
} }
} }
</script> </script>

269
pages/productDetails/index.vue

@ -3,7 +3,10 @@
<uni-nav-bar :statusBar="true" left-icon="left" color="#000000" :leftWidth="navWidth" :rightWidth="navWidth" :fixed="true" @clickLeft="back"> <uni-nav-bar :statusBar="true" left-icon="left" color="#000000" :leftWidth="navWidth" :rightWidth="navWidth" :fixed="true" @clickLeft="back">
<view class="input-view"> <view class="input-view">
<uni-icons class="input-uni-icon" type="search" size="18" color="#999" /> <uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
<input confirm-type="search" class="nav-bar-input" type="text" placeholder="search" @confirm="confirm" /> <navigator url="/pages/index/search">
<input confirm-type="search" class="nav-bar-input" type="text" placeholder="search" />
</navigator>
</view> </view>
<block slot="right"> <block slot="right">
<view class="nav_right"> <view class="nav_right">
@ -66,30 +69,33 @@
</view> </view>
<view>{{goodsDate.goods_name}} </view> <view>{{goodsDate.goods_name}} </view>
<view class="evaluate"> <view class="evaluate">
<uni-rate size="18" :value="4" active-color="red" :is-fill="false"/> <uni-rate size="18" :disabled="true" disabledColor="red" :value="goodsDate.comment_summary[0].commentcount==0?'0':'4'" active-color="red" :is-fill="false" />
<view class="evaluate_text">4.0</view> <view class="evaluate_text">{{goodsDate.comment_summary[0].commentcount==0?'0.0':'4.0'}}</view>
<text>({{goodsDate.comment_summary[0].commentcount}}reviews)</text> <text>({{goodsDate.comment_summary[0].commentcount}}reviews)</text>
</view> </view>
<view class="variations"> <view class="variations">
<view class="variations_title"> <view class="variations_title">
<view class="variations_title_left">Variations</view> <view class="variations_title_left">Variations</view>
<text>2color</text> <text>{{colorNum}}color</text>
</view> </view>
<view class="variations_select"> <view class="variations_select">
<view class="variations_select_varieties"> <view v-for="(item,index) in goodsDate.attr_list" :key="index" class="variations_select">
<view class="select_varieties_image" v-for="(item,index) in 3" :key="index"></view> <!-- <view class="variations_select_varieties" >
</view> <view class="select_varieties_image" v-for="(item,index) in 3" :key="index"></view>
<view class="variations_select_size"> </view> -->
<view class="select_size_item">34</view> <view class="variations_select_size">
<view class="select_size_item">35</view> <view class="select_size_item" v-for="(item1,index1) in item.goods_attrs" :key="index1">{{item1.attr_value}}</view>
<view class="select_size_item">M</view> <!-- <view class="select_size_item">35</view>
<view class="select_size_item">L</view> <view class="select_size_item">M</view>
<view class="select_size_item">L</view> -->
</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="promotion"> <view class="promotion" v-if="goodsDate.is_promote==1">
<view class="promotion_title">Promotion</view> <view class="promotion_title">Promotion</view>
<view class="promotion_content"> <view class="promotion_content">
<view class="promotion_content_item"> <view class="promotion_content_item">
@ -110,7 +116,7 @@
</view> </view>
<view class="transport"> <view class="transport">
<view class="goods_title">Shipping to United States</view> <view class="goods_title">Shipping to {{addressDate.country_name || 'United States'}}</view>
<view class="goods_title title_Mtop"> <view class="goods_title title_Mtop">
<view class="goods_title_left"> <view class="goods_title_left">
<image src="/static/img/transport.png" mode=""></image> <image src="/static/img/transport.png" mode=""></image>
@ -148,8 +154,8 @@
<li>Safe Payments </li> <li>Safe Payments </li>
</ul> </ul>
<ul> <ul>
<li>Safe Payments </li> <li>Secure Logistics </li>
<li>Safe Payments </li> <li>Secure Logistics </li>
</ul> </ul>
</view> </view>
</view> </view>
@ -158,7 +164,8 @@
<text>Description</text> <text>Description</text>
</view> </view>
<view class="goods_title_right"> <view class="goods_title_right">
<view>#Iron #Pearls,Flowers #Fashionable</view> <!-- <view>#Iron #Pearls,Flowers #Fashionable</view> -->
<view>{{goodsDate.tags}}</view>
<image src="../../static/img/right.png" mode=""></image> <image src="../../static/img/right.png" mode=""></image>
</view> </view>
</view> </view>
@ -167,7 +174,7 @@
<view class="reviews"> <view class="reviews">
<view class="goods_title"> <view class="goods_title">
<view class="goods_title_left"> <view class="goods_title_left">
<text>Reviews(24)</text> <text>Reviews({{goodsDate.comment_summary[0].commentcount}})</text>
</view> </view>
<view class="goods_title_right"> <view class="goods_title_right">
<image src="../../static/img/right.png" mode=""></image> <image src="../../static/img/right.png" mode=""></image>
@ -175,30 +182,37 @@
</view> </view>
<view class="allReviews"> <view class="allReviews">
<text>4.0</text> <text>{{goodsDate.comment_summary[0].commentcount==0?'0.0':'4.0'}}</text>
<uni-rate size="40" :disabled="true" disabledColor="red" :value="4" active-color="red" :is-fill="false"/> <uni-rate size="40" :disabled="true" disabledColor="red" :value="goodsDate.comment_summary[0].commentcount==0?'0':'4'" active-color="red" :is-fill="false"/>
</view> </view>
<template v-if="goodsDate.comment_summary[0].commentcount==0">
<view class="reviews_item" v-for="(item,index) in 2" :key="index"> <view class="reviews_no">No comment yet</view>
<view class="reviews_item_title"> </template>
<view class="reviews_title_user"> <template v-else>
<text>e***8</text> <view class="reviews_item" v-for="(item,index) in 2" :key="index">
<uni-rate size="18" :disabled="true" disabledColor="red" :value="4" active-color="red" :is-fill="false"/> <view class="reviews_item_title">
<view class="reviews_title_user">
<text>e***8</text>
<uni-rate size="18" :disabled="true" disabledColor="red" :value="4" active-color="red" :is-fill="false"/>
</view>
<view class="reviews_title_time">07/03/2022</view>
</view>
<view class="reviews_item_color">Color:Multicolor</view>
<view class="reviews_item_content">So unique! Cant wait to wear these.</view>
<view class="reviews_item_image">
<view class="reviews_image_content" v-for="(item,index) in 2" :key="index"></view>
</view> </view>
<view class="reviews_title_time">07/03/2022</view>
</view>
<view class="reviews_item_color">Color:Multicolor</view>
<view class="reviews_item_content">So unique! Cant wait to wear these.</view>
<view class="reviews_item_image">
<view class="reviews_image_content" v-for="(item,index) in 2" :key="index"></view>
</view> </view>
</view> </template>
</view> </view>
<view class="productImage"> <view class="productImage">
<view class="productImage_title">Product lmage gallery</view> <view class="productImage_title">Product lmage gallery</view>
<view class="productImage_image"></view> <view class="productImage_image" v-html="goodsDate.goods_desc">
<view class="recommend recommend1"> <!-- {{goodsDate.goods_desc}} -->
<!-- <image :src="goodsDate.goods_img" mode=""></image> -->
</view>
<view class="recommend recommend1" v-if="goodsDate.category_list">
<view class="recommend_title">Other options</view> <view class="recommend_title">Other options</view>
<scroll-view class="spike1 " scroll-x="true" :show-scrollbar="false"> <scroll-view class="spike1 " scroll-x="true" :show-scrollbar="false">
<view class="spike1_item1" v-for="(item,index) in 8" :key="index" > <view class="spike1_item1" v-for="(item,index) in 8" :key="index" >
@ -209,14 +223,18 @@
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<view class="productImage_image1"></view> <view class="productImage_image1">
<image :src="goodsDate.goods_thumb" mode=""></image>
</view>
<view class="recommend"> <view class="recommend">
<view class="recommend_title">You might also like</view> <view class="recommend_title">You might also like</view>
<view class="recommend_content"> <view class="recommend_content">
<view class="recommend_content_item" v-for="(item,index) in 2 " :key="index"> <view class="recommend_content_item" v-for="(item,index) in catList " :key="index" @click="goDetails(item.id)">
<view class="recommend_content_item_image"></view> <view class="recommend_content_item_image">
<text>Adidas Yeezy Boost 350 DazzlingBlue Black</text> <image :src="item.thumb" mode=""></image>
<view class="recommend_content_item_pric">US$314.00</view> </view>
<text>{{item.short_name}}</text>
<view class="recommend_content_item_pric">US${{item.is_promote==0? item.shop_price :item.promote_price}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -266,22 +284,33 @@
<view class="addCard" v-show="isCart"> <view class="addCard" v-show="isCart">
<image src="/static/img/close1.png" mode="" class="addCard_close"></image> <image src="/static/img/close1.png" mode="" class="addCard_close"></image>
<scroll-view class="spike1 " scroll-x="true" :show-scrollbar="false"> <scroll-view class="spike1 " scroll-x="true" :show-scrollbar="false">
<image src="../../static/img/logo.png" mode="" class="addCard_scroll" v-for="(item,index) in 3" :key="index" ></image> <image :src="item.img_url" mode="" class="addCard_scroll" v-for="(item,index) in goodsDate.gallery_list" :key="index" ></image>
</scroll-view> </scroll-view>
<view class="addCard_body"> <view class="addCard_body">
<view >Adidas Yeezy Boost 350 V2 Dazzling Blue Black GY 7164 Men's Sizes </view> <view >{{goodsDate.goods_name}} </view>
<view class="addCard_price">US$314.00</view> <view class="addCard_price">US${{goodsDate.is_promote==0? goodsDate.shop_price :goodsDate.promote_price}}</view>
<view >Color Family</view> <view v-for="(item,index) in goodsDate.attr_list" :key="item.attr_id">
<view class="color_select"> <view >{{item.attr_name}}</view>
<view class="color_select_item" v-for="(item,index) in 3" :key="index" :class="index==0?'active_color':''"> <view class="color_select variations_select_size">
<view class="color_select_item_zoom">
<image src="../../static/img/zoom.png" mode=""></image> <view class="select_size_item"
v-for="(item1,index1) in item.goods_attrs"
:key="item1.goods_attr_id"
:class="goods_attr_list[index].goods_attr_id==item1.goods_attr_id?'active_color':''"
@click="selectAttr(item.attr_id,item1.goods_attr_id,index)">
{{item1.attr_value}}
</view> </view>
<image src="../../static/img/logo.png" mode=""></image> <!-- <view class="color_select_item" v-for="(item,index) in 3" :key="index" :class="index==0?'active_color':''">
<view class="color_select_item_bottom">021Blue</view> <view class="color_select_item_zoom">
<image src="../../static/img/zoom.png" mode=""></image>
</view>
<image src="../../static/img/logo.png" mode=""></image>
<view class="color_select_item_bottom">021Blue</view>
</view> -->
</view> </view>
</view> </view>
<view >Size</view>
<!-- <view >Size</view>
<view class="variations_select_size"> <view class="variations_select_size">
<view class="select_size_item">34</view> <view class="select_size_item">34</view>
<view class="select_size_item">35</view> <view class="select_size_item">35</view>
@ -290,7 +319,7 @@
<view class="select_size_item">38</view> <view class="select_size_item">38</view>
<view class="select_size_item">M</view> <view class="select_size_item">M</view>
<view class="select_size_item">L</view> <view class="select_size_item">L</view>
</view> </view> -->
<view class="quantity"> <view class="quantity">
<text>Quantity</text> <text>Quantity</text>
<uni-number-box background="#FFFFFF">1</uni-number-box> <uni-number-box background="#FFFFFF">1</uni-number-box>
@ -302,7 +331,7 @@
</template> </template>
<script> <script>
import {defaultRequest,defaultRequest2} from '../../api/index.js' import {defaultRequest,defaultRequest2,defaultRequest4} from '../../api/index.js'
export default { export default {
data() { data() {
return { return {
@ -319,12 +348,87 @@
goodsDate:{ goodsDate:{
comment_summary:[ comment_summary:[
{comment_summary:'',commentlabel: ""} {comment_summary:'',commentlabel: ""}
],
gallery_list:[
{content:''}
] ]
}, },
user_info:{} user_info:{},
addressDate:{},
colorNum:0,
//
goods_attr_list:[
{goods_attr_id:''}
],
catQuery:{
_action:'getgoods',
cat:'',
page_index:1,
page_size:10
},
catList:[],
isReachBottom:true
} }
}, },
methods:{ methods:{
//
goDetails(id){
uni.navigateTo({
url:'index?goods_id='+id
})
},
//
getCatList(type){
defaultRequest4(this.catQuery).then(res=>{
console.info(res)
if(res.error==0){
if(res.data){
if(type==0){
this.catList=res.data
}else{
this.catList=this.catList.concat(res.data)
}
}else{
this.isReachBottom=false
uni.showToast({
title: 'No more data yet',
icon:'none'
})
this.catQuery.page_index--
}
}
uni.hideNavigationBarLoading();
})
},
//
selectAttr(attr_id,goods_attr_id,index){
let data={attr_id:attr_id,goods_attr_id:goods_attr_id}
if(this.goods_attr_list.length==0){
this.goods_attr_list.push(data)
}else{
//
let isNew=false
// for(i in this.goods_attr_list){
// let item=this.goods_attr_list[i]
// if(item.attr_id==attr_id){
// this.goods_attr_list[i].goods_attr_id=goods_attr_id
// }
// }
this.goods_attr_list.map(item=>{
if(item.attr_id==attr_id){
item.goods_attr_id=goods_attr_id
isNew=false
return
}else{
isNew=true
}
})
if(isNew){
this.goods_attr_list.splice(index,0,data)
}
}
},
// //
addLike(id){ addLike(id){
let data={_action:'setfaviouritegoods',goods_id:this.query.goods_id} let data={_action:'setfaviouritegoods',goods_id:this.query.goods_id}
@ -360,6 +464,16 @@
console.info(res) console.info(res)
}) })
}, },
//
getDefaultAddress(){
let data={_action:'getdefaultconsignee'}
defaultRequest2(data).then(res=>{
console.info(res)
if(res.error==0){
this.addressDate=res.data
}
})
},
// //
getDate(){ getDate(){
defaultRequest(this.query).then(res=>{ defaultRequest(this.query).then(res=>{
@ -369,6 +483,13 @@
this.goodsDate.gallery_list.map(item=>{ this.goodsDate.gallery_list.map(item=>{
item.content='' item.content=''
}) })
this.goodsDate.attr_list.map(item=>{
if(item.attr_name=="Color"){
this.colorNum=item.goods_attrs.length
}
})
this.catQuery.cat=res.data.cat_id
this.getCatList(0)
} }
}) })
}, },
@ -383,9 +504,6 @@
// this.isVedio=false // this.isVedio=false
// } // }
this.current = e.detail.current this.current = e.detail.current
},
confirm(){
}, },
back(){ back(){
uni.navigateBack() uni.navigateBack()
@ -397,8 +515,24 @@
this.user_info=uni.getStorageSync('user_info') this.user_info=uni.getStorageSync('user_info')
if(this.user_info.isLogin){ if(this.user_info.isLogin){
this.setFavorites() this.setFavorites()
this.getDefaultAddress()
} }
},
//
onReachBottom(){
if(!this.isReachBottom)return
if(this.catQuery.page_index>=5){
uni.hideNavigationBarLoading();
uni.showToast({
title: 'No more data yet',
icon:'none'
})
}else{
this.catQuery.page_index++
this.getCatList(1)
}
} }
} }
</script> </script>
@ -411,6 +545,11 @@
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
$nav-height: 30px; $nav-height: 30px;
.reviews_no{
padding: 30rpx;
text-align: center;
font-weight: bold;
}
.showVedio{ .showVedio{
/deep/ .uni-swiper__dots-nav{ /deep/ .uni-swiper__dots-nav{
display: none; display: none;
@ -463,7 +602,6 @@
margin-left: 20.67rpx; margin-left: 20.67rpx;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
.select_size_item{ .select_size_item{
background-color: #F8F8F8; background-color: #F8F8F8;
width: 121.33rpx; width: 121.33rpx;
@ -475,6 +613,8 @@
color: #666666; color: #666666;
font-size: 24rpx; font-size: 24rpx;
margin-right: 18.67rpx; margin-right: 18.67rpx;
border: 1px solid #F8F8F8;
padding: 0 10rpx;
&:nth-child(-n+2){ &:nth-child(-n+2){
margin-bottom: 16.67rpx; margin-bottom: 16.67rpx;
@ -581,7 +721,7 @@
margin-bottom: 40.67rpx; margin-bottom: 40.67rpx;
.select_size_item{ .select_size_item{
margin-bottom: 16.67rpx !important; margin-bottom: 16.67rpx !important;
&:nth-child(5n+5){ &:nth-child(4n+4){
margin-right: 0; margin-right: 0;
} }
} }
@ -1058,14 +1198,23 @@
} }
.productImage_image{ .productImage_image{
width: 100%; width: 100%;
height: 788rpx; min-height: 788rpx;
margin-bottom: 62rpx; margin-bottom: 62rpx;
background-color: #999999; background-color: #999999;
image{
width: 100%;
height: 100%;
}
} }
.productImage_image1{ .productImage_image1{
width: 100%; width: 100%;
height: 532rpx; height: 532rpx;
background-color: #999999; background-color: #999999;
image{
width: 100%;
height: 100%;
}
} }
.recommend1{ .recommend1{
padding-top: 0; padding-top: 0;

BIN
static/img/select4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Loading…
Cancel
Save