update api

This commit is contained in:
ghusermoon 2020-06-29 17:24:57 +08:00
parent 905022e6e4
commit dce6d3a1b8
19 changed files with 280 additions and 87 deletions

View File

@ -1,6 +1,16 @@
export default { export default {
init(vm){ init(vm){
return { return {
// 发现列表
getArticlelist({ page, value, store_id, member_id, is_video_img }){
return vm.$u.post('article/articlelist', {
page: page,
like: value, // 搜索内容
store_id: store_id,
member_id: member_id,
is_video_img: is_video_img,
});
},
// 获取商城首页信息(顶部轮播图与商品分类) // 获取商城首页信息(顶部轮播图与商品分类)
getShopTopList(){ getShopTopList(){
return vm.$u.post('Shop/getShopTopList'); return vm.$u.post('Shop/getShopTopList');
@ -29,7 +39,13 @@ export default {
// 购物车删除商品 // 购物车删除商品
deleteCart({ id }) { deleteCart({ id }) {
return vm.$u.post('cart/cartDel', { return vm.$u.post('cart/cartDel', {
cart_id: id cart_ids: id
});
},
// 商品详情
getGoodsDetails({ id }) {
return vm.$u.post('Goods/goodDetails', {
goods_id: id
}); });
} }
} }

View File

@ -189,7 +189,12 @@ export default {
sex: gender, sex: gender,
avatar: avatar, avatar: avatar,
}); });
} },
// 用户浏览记录
getBrowseList() {
return vm.$u.post('Member/BrowseList');
},
} }
} }
} }

View File

@ -1,16 +1,31 @@
<template> <template>
<view class="video-item"> <view class="video-item" v-if="item">
<image class="head"> <image class="head" :src="item.article_pic"></image>
<view class="title" v-if="!isguanzhu">{{ item.article_title }}</view>
</image>
<view class="title" v-if="!isguanzhu">这是标题这是标题这是标题</view>
<view class="jianjie">这是简介这是简介这是简介</view> <view class="jianjie">这是简介这是简介这是简介</view>
<view class="user"> <view class="user">
<view> <view class="info">
<image></image> <image :src="item.member_avatar"></image>
<text>这是名字</text> <text>{{ item.member_nickname }}</text>
</view> </view>
<image></image> <image src="/static/image/common/4.png" @click="showAction"></image>
<view class="action" v-if="show == item.article_id">
<view class="bubble">
<view>
<image src="/static/image/common/5.png"></image>
<text>点赞</text>
</view>
<view>
<image src="/static/image/common/6.png"></image>
<text>收藏</text>
</view>
<view>
<image src="/static/image/common/7.png"></image>
<text>屏蔽用户</text>
</view>
</view>
</view>
<view class="layer" v-if="show == item.article_id" @click.stop="show=-1"></view>
</view> </view>
</view> </view>
</template> </template>
@ -33,7 +48,7 @@
color: #333; color: #333;
font-weight: 500; font-weight: 500;
line-height: 30rpx; line-height: 30rpx;
width: 307rpx; width: 300rpx;
overflow:hidden; overflow:hidden;
text-overflow:ellipsis; text-overflow:ellipsis;
display:-webkit-box; display:-webkit-box;
@ -46,7 +61,7 @@
font-size: 22rpx; font-size: 22rpx;
color: #666; color: #666;
line-height: 30rpx; line-height: 30rpx;
width: 307rpx; width: 300rpx;
margin-left: 18rpx; margin-left: 18rpx;
overflow:hidden; overflow:hidden;
text-overflow:ellipsis; text-overflow:ellipsis;
@ -61,8 +76,9 @@
align-items: center; align-items: center;
margin:0 auto; margin:0 auto;
margin-top: 20rpx; margin-top: 20rpx;
width: 307rpx; width: 300rpx;
>view{ position: relative;
.info {
display: flex; display: flex;
align-items: center; align-items: center;
>image{ >image{
@ -81,6 +97,70 @@
width: 37rpx; width: 37rpx;
height: 8rpx; height: 8rpx;
} }
.action {
z-index: 19;
position: absolute;
right: 0rpx;
bottom: 55rpx;
// width: 234rpx;
background: rgba(255,255,255,1);
box-shadow: 0rpx 0rpx 6rpx 0rpx rgba(35,24,21,0.12);
border-radius: 6rpx;
.bubble {
position: relative;
background-color: #fff;
&::after {
position: absolute;
right: 10rpx;
bottom: 0;
content: '';
width: 60rpx;
height: 40rpx;
background-color: inherit;
transform: rotate(45deg);
margin-top: -10rpx;
z-index: -1;
box-shadow: 0rpx 0rpx 6rpx 0rpx rgba(35,24,21,0.12);
}
> view {
padding: 9rpx 12rpx;
display: flex;
align-items: center;
&:not(:last-child) {
border-bottom: 2rpx #ECECEC solid;
}
@mixin image-class($width, $height, $right) {
width: $width;
height: $height;
margin-right: $right;
}
> image {
&:first-child {
@include image-class($width: 21rpx, $height: 22rpx, $right: 12rpx);
}
&:nth-child(2) {
@include image-class($width: 22rpx, $height: 22rpx, $right: 12rpx);
}
&:last-child {
@include image-class($width: 24rpx, $height: 20rpx, $right: 9rpx);
}
}
> text {
font-size: 20rpx;
color: rgba(51,51,51,1);
}
}
}
}
.layer {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 9;
background-color: transparent;
}
} }
} }
</style> </style>
@ -89,9 +169,18 @@ export default {
name:"index-item", name:"index-item",
data(){ data(){
return { return {
show: -1,
}
},
props:["isguanzhu", "item"],
mounted() {
// console.log(this.item);
this.show = -1;
},
methods: {
showAction() {
this.show = this.show > 0 ? -1 : this.item.article_id;
} }
}, },
props:["isguanzhu"]
} }
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<view class="item" @click="addCart"> <view class="item" @click="toDetailsPage">
<image :src="info.goods_image" class="img"></image> <image :src="info.goods_image" class="img"></image>
<view class="info"> <view class="info">
<text class="title u-line-1">{{ info.goods_name }}</text> <text class="title u-line-1">{{ info.goods_name }}</text>
@ -15,14 +15,11 @@ export default {
info: Object info: Object
}, },
methods: { methods: {
addCart() { toDetailsPage() {
console.log(1); this.$u.route({
url: 'pageB/sdetails/index',
this.$u.api.addCart({ params: {
goods_id: this.info.goods_id, id: this.info.goods_id
quantity: 1
}).then((res)=>{
if (res.errCode == 0) {
} }
}) })
} }

View File

@ -1,12 +1,15 @@
<template> <template>
<view class="nav"> <view class="nav">
<text>dsadasdas</text> <text>{{ value }}</text>
<image></image> <image src="/static/image/common/1.png"></image>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name:"navs" name:"navs",
props: {
value: String
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -2,24 +2,40 @@
<view class="tloos"> <view class="tloos">
<view class="navs"> <view class="navs">
<image></image> <image></image>
123 店铺
</view> </view>
<view class="navs" style="margin-right:30rpx"> <view class="navs" style="margin-right:30rpx">
<image></image> <image></image>
123 客服
</view> </view>
<view class="button" style="background:rgba(253,211,96,0.6);">试穿试送</view> <view class="button" style="background:rgba(253,211,96,0.6);">试穿试送</view>
<view class="button" style="background:rgba(253,211,96,1);">加入购物车</view> <view class="button" style="background:rgba(253,211,96,1);" @click="addCart">加入购物车</view>
<view class="button" style="background:rgba(255,120,15,1);">立即购买</view> <view class="button" style="background:rgba(255,120,15,1);">立即购买</view>
<u-toast ref="uToast" />
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name:"tloos" name:"tloos",
props: ['id'],
methods: {
addCart() {
this.$u.api.addCart({
goods_id: this.id,
quantity: 1,
}).then(res => {
this.$refs.uToast.show({
title: res.message,
type: res.errCode == 0 ? 'success' : 'warning',
})
})
}
},
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.tloos{ .tloos{
background-color: #fff;
display: flex; display: flex;
position: fixed; position: fixed;
height: 98rpx; height: 98rpx;

View File

@ -3,27 +3,27 @@
<u-swiper :list="list" height="500" border-radius="0"></u-swiper> <u-swiper :list="list" height="500" border-radius="0"></u-swiper>
<view class="info"> <view class="info">
<view class="title"> <view class="title">
<text>萨的环境</text> <text>{{ goodsInfo.store_name }}</text>{{ goodsInfo.goods_name }}
套装新款小个子春季时尚韩版短袖衬衫套装
新款小个子春季时尚韩版...
</view> </view>
<view class="pic"> <view class="pic">
<text>24</text> <text>{{ goodsInfo.goods_price }}</text>
<s>12</s> <s>{{ goodsInfo.goods_marketprice }}</s>
</view> </view>
</view> </view>
<view class="hr"></view> <view class="hr"></view>
<navs></navs> <!-- <navs :value="领券"></navs> -->
<navs></navs> <navs :value="产品规格"></navs>
<navs></navs> <navs :value="产品颜色"></navs>
<navs :value="选择尺码"></navs>
<view class="xiangqing"> <view class="xiangqing">
<view class="heng"></view> <view class="heng"></view>
<view class="title">商品详情</view> <view class="title">商品详情</view>
<view class="heng"></view> <view class="heng"></view>
</view> </view>
<tloos></tloos> <view class="rich">
<rich-text :nodes="goodsInfo.mobile_body"></rich-text>
</view>
<tloos :id="goodsInfo.goods_commonid"></tloos>
</view> </view>
</template> </template>
<script> <script>
@ -31,38 +31,46 @@ import navs from "../components/sdetails/navs"
import tloos from "../components/sdetails/tloos" import tloos from "../components/sdetails/tloos"
export default { export default {
name:"sdetails", name:"sdetails",
data() {
return {
list: [],
goodsInfo: {},
}
},
components:{ components:{
navs, navs,
tloos tloos
}, },
data() { onLoad(option) {
return { this.getGoodsDetails(option.id);
list: [{
image: '/static/uView/swiper/swiper1.jpg',
title: '蒹葭苍苍,白露为霜。所谓伊人,在水一方'
}, },
{ methods: {
image: '/static/uView/swiper/swiper2.jpg', getGoodsDetails(id) {
title: '溯洄从之,道阻且长。溯游从之,宛在水中央' this.$u.api.getGoodsDetails({ id: 169 }).then((res)=>{
if (res.errCode == 0) {
this.goodsInfo = res.data;
this.goodsInfo.goods_image_mobile.forEach(item => {
let temp = {
image: item
}
this.list.push(temp);
})
console.log(this.goodsInfo.mobile_body);
}
})
}
}, },
{
image: '/static/uView/swiper/swiper3.jpg',
title: '蒹葭萋萋,白露未晞。所谓伊人,在水之湄'
}
]
}
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.sdetails{ .sdetails{
/deep/image{ padding-bottom: 98rpx;
background-color: #0f0;
}
.info{ .info{
padding: 30rpx; padding: 30rpx;
.title{ .title{
flex-wrap: wrap; flex-wrap: wrap;
margin-bottom: 30rpx;
>text{ >text{
padding: 13rpx; padding: 13rpx;
font-size: 24rpx; font-size: 24rpx;
@ -109,5 +117,8 @@ export default {
margin: 0 20rpx; margin: 0 20rpx;
} }
} }
.rich {
width: 100%;
}
} }
</style> </style>

View File

@ -38,6 +38,7 @@
</view> </view>
<view class="cart-btn" v-if="status == '编辑'" @click="settlement">结算</view> <view class="cart-btn" v-if="status == '编辑'" @click="settlement">结算</view>
<view class="delete-btn" v-if="status == '完成'" @click="deleteGoods">删除</view> <view class="delete-btn" v-if="status == '完成'" @click="deleteGoods">删除</view>
<u-toast ref="uToast" />
</view> </view>
</view> </view>
</template> </template>
@ -62,7 +63,7 @@ export default {
}) })
checkedGoods = checkedGoods.concat(temp); checkedGoods = checkedGoods.concat(temp);
}) })
// console.log(checkedGoods); console.log(checkedGoods);
this.checkedGoods = checkedGoods; this.checkedGoods = checkedGoods;
}, },
deep: true deep: true
@ -88,9 +89,23 @@ export default {
}) })
}, },
deleteGoods() { deleteGoods() {
if(!this.checkedGoods.length) return false;
let id = []; let id = [];
this.checkedGoods.forEach(item => {
id.push(item.cart_id);
})
// console.log(id);
this.$u.api.deleteCart({ id }).then(res => { this.$u.api.deleteCart({ id }).then(res => {
if (res.errCode == 0) { if (res.errCode == 0) {
if(!res.data.msg) {
this.getCartList();
} else {
this.$refs.uToast.show({
title: res.data.msg,
type: 'error',
})
}
} }
}) })
}, },

View File

@ -3,19 +3,20 @@
<view class="history-box"> <view class="history-box">
<view v-for="(item, index) in historyList" :key="index" class="history-item"> <view v-for="(item, index) in historyList" :key="index" class="history-item">
<view class="item-title"> <view class="item-title">
<img src="../static/mine/23.png" /> <image src="../static/mine/23.png"></image>
<view>小米店铺</view> <view>小米店铺</view>
</view> </view>
<!-- <view class="item-image"> <!-- <view class="item-image">
<img src="../static/mine/23.png" /> <img src="../static/mine/23.png" />
</view> --> </view> -->
<img src="../static/mine/23.png" class="item-image" /> <image src="../static/mine/23.png" class="item-image"></image>
<view class="item-info"> <view class="item-info">
<view class="info-name">{{ item }}</view> <view class="info-name">{{ item }}</view>
<img src="../static/mine/22.png" /> <image src="../static/mine/22.png"></image>
</view> </view>
</view> </view>
</view> </view>
<u-empty text="暂无足迹" mode="list" color="#000" margin-top="240" v-if="!historyList.length"></u-empty>
</view> </view>
</template> </template>
@ -26,8 +27,18 @@ export default {
historyList: [1, 2, 3, 6] historyList: [1, 2, 3, 6]
}; };
}, },
onLoad() {}, onLoad() {
methods: {} this.getBrowseList();
},
methods: {
getBrowseList () {
this.$u.api.getBrowseList().then(res => {
if(res.errCode == 0) {
this.historyList = res.data.storeInfo;
}
})
}
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -48,7 +59,7 @@ export default {
.item-title { .item-title {
display: flex; display: flex;
align-items: center; align-items: center;
> img { > image {
width: 50rpx; width: 50rpx;
height: 50rpx; height: 50rpx;
border-radius: 50%; border-radius: 50%;
@ -73,7 +84,7 @@ export default {
font-size: 22rpx; font-size: 22rpx;
color: rgba(51,51,51,1); color: rgba(51,51,51,1);
} }
> img { > image {
width: 37rpx; width: 37rpx;
height: 8rpx; height: 8rpx;
} }

View File

@ -23,14 +23,13 @@
<indexad style="width:690rpx"></indexad> <indexad style="width:690rpx"></indexad>
<view class="list"> <view class="list">
<view > <view >
<videoItem v-for="item in 10"></videoItem> <videoItem v-for="item in articleList.filter((_, index) => !(index&1))" :key="item.article_id" :item="item"></videoItem>
</view> </view>
<view style="margin-left:20rpx"> <view style="margin-left:20rpx">
<videoItem v-for="item in 10"></videoItem> <videoItem v-for="item in articleList.filter((_, index) => index&1)" :key="item.article_id" :item="item"></videoItem>
</view> </view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
<swiper-item> <swiper-item>
@ -178,7 +177,9 @@ export default {
name: '关注' name: '关注'
} }
], ],
num:0 num:0,
page: 0, // 0
articleList: [],
} }
}, },
components:{ components:{
@ -187,6 +188,9 @@ export default {
indexad, indexad,
darenItem darenItem
}, },
onLoad(){
this.getArticlelist();
},
methods:{ methods:{
dianji(a){ dianji(a){
console.log(a) console.log(a)
@ -195,15 +199,17 @@ export default {
}else{ }else{
this.num = a this.num = a
} }
},
getArticlelist () {
this.$u.api.getArticlelist({
page: this.page,
is_video_img: 0, // 1 2 0
}).then(res => {
if(res.errCode == 0) {
this.articleList = res.data.list;
}
})
} }
}, },
onLoad(){
// this.$u.api.phoneLogin({
// member_mobile: 1,
// sms_code: 2
// }).then((res)=>{
// console.log(res)
// })
}
} }
</script> </script>

View File

@ -128,7 +128,7 @@ export default {
}, },
filters: { filters: {
phoneFormat(value) { phoneFormat(value) {
return value.replace(/^(\d{3})\d*(\d{4})$/, '$1****$2'); return value ? value.replace(/^(\d{3})\d*(\d{4})$/, '$1****$2') : '';
} }
}, },
onLoad() { onLoad() {

View File

@ -46,6 +46,9 @@
<youhq></youhq> <youhq></youhq>
<view class="hr" style="margin-top:40rpx"></view> <view class="hr" style="margin-top:40rpx"></view>
<list :classifyList="classifyList" :goodsList="goodsList"></list> <list :classifyList="classifyList" :goodsList="goodsList"></list>
<view class="cart" @click="toCartPage">
<image src="/static/image/common/3.png"></image>
</view>
<u-picker mode="region" :params="areaParams" v-model="chooseArea" @confirm="setArea"></u-picker> <u-picker mode="region" :params="areaParams" v-model="chooseArea" @confirm="setArea"></u-picker>
</view> </view>
</template> </template>
@ -109,7 +112,6 @@ export default {
this.$u.api.getGoodsRecommend({ this.$u.api.getGoodsRecommend({
page: 1, page: 1,
}).then((res)=>{ }).then((res)=>{
console.log(res);
if (res.errCode == 0) { if (res.errCode == 0) {
this.classifyList = res.data.classifyList; this.classifyList = res.data.classifyList;
this.goodsList = res.data.goodsList; this.goodsList = res.data.goodsList;
@ -121,6 +123,11 @@ export default {
setArea(e) { setArea(e) {
// console.log(e); // console.log(e);
this.area = e.city.label; this.area = e.city.label;
},
toCartPage() {
uni.navigateTo({
url: '/pageC/cart/index'
});
} }
}, },
} }
@ -198,5 +205,22 @@ export default {
margin-top: 29rpx; margin-top: 29rpx;
background-color: #ececec; background-color: #ececec;
} }
.cart {
position: fixed;
right: 30rpx;
bottom: 300rpx;
width: 100rpx;
height: 100rpx;
background: rgba(253, 211, 96, 1);
box-shadow: 0rpx 10rpx 6rpx 0rpx rgba(253,211,96,0.34);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
> image {
width: 56rpx;
height: 54rpx;
}
}
} }
</style> </style>

BIN
static/image/common/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
static/image/common/12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
static/image/common/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
static/image/common/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 B

BIN
static/image/common/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
static/image/common/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
static/image/common/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB