update api

This commit is contained in:
ghusermoon 2020-06-29 08:47:37 +08:00
parent 28e80b49ff
commit 905022e6e4
9 changed files with 209 additions and 79 deletions

View File

@ -19,6 +19,19 @@ export default {
getCartTreeList() { getCartTreeList() {
return vm.$u.post('cart/cartTreeList'); return vm.$u.post('cart/cartTreeList');
}, },
// 添加购物车
addCart({ goods_id, quantity }) {
return vm.$u.post('cart/cartAdd', {
goods_id: goods_id,
quantity: quantity
});
},
// 购物车删除商品
deleteCart({ id }) {
return vm.$u.post('cart/cartDel', {
cart_id: id
});
}
} }
} }

View File

@ -175,9 +175,21 @@ export default {
// 店铺收藏列表 // 店铺收藏列表
getStoreFavoritesList({ type }) { getStoreFavoritesList({ type }) {
return vm.$u.post('Member/getFavoritesList', { return vm.$u.post('Member/getFavoritesList', {
type: type type: type,
}); });
}, },
// 设置-用户信息
getMemberInfo() {
return vm.$u.post('Member/MemberInfo');
},
// 设置-修改用户信息
updateMemberInfo({ nickname, gender, avatar }) {
return vm.$u.post('Member/changeMemberInfo', {
nickname: nickname,
sex: gender,
avatar: avatar,
});
}
} }
} }
} }

View File

@ -4,7 +4,6 @@
商品推荐 商品推荐
</view> </view>
<view class="label"> <view class="label">
<text>分类名称</text>
<text v-for="item in classifyList" :key="item.gc_id">{{ item.gc_name }}</text> <text v-for="item in classifyList" :key="item.gc_id">{{ item.gc_name }}</text>
</view> </view>
<view class="item"> <view class="item">

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="item"> <view class="item" @click="addCart">
<image :src="$u.http.config.baseUrl + 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>
<text class="jianjie u-line-2">{{ info.goods_advword }}</text> <text class="jianjie u-line-2">{{ info.goods_advword }}</text>
@ -13,7 +13,20 @@ export default {
name:"item", name:"item",
props: { props: {
info: Object info: Object
} },
methods: {
addCart() {
console.log(1);
this.$u.api.addCart({
goods_id: this.info.goods_id,
quantity: 1
}).then((res)=>{
if (res.errCode == 0) {
}
})
}
},
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -5,20 +5,20 @@
<view class="store"> <view class="store">
<u-checkbox v-model="store.checked" shape="circle" active-color="#FF780F" icon-size="35" :name="s_index" @change="storeaAloneChange"></u-checkbox> <u-checkbox v-model="store.checked" shape="circle" active-color="#FF780F" icon-size="35" :name="s_index" @change="storeaAloneChange"></u-checkbox>
<view class="name"> <view class="name">
<image></image> <image :src="store.store_avatar"></image>
<view>胖胖的店</view> <view>{{ store.store_name }}</view>
</view> </view>
</view> </view>
<view class="goods"> <view class="goods">
<u-checkbox-group @change="goodsChange($event, s_index)"> <u-checkbox-group @change="goodsChange($event, s_index)">
<view v-for="(goods, g_index) in store.goods" :key="g_index" class="goods-item"> <view v-for="(goods, g_index) in store.goods" :key="g_index" class="goods-item">
<u-checkbox v-model="goods.checked" shape="circle" active-color="#FF780F" icon-size="35" :name="g_index" ></u-checkbox> <u-checkbox v-model="goods.checked" shape="circle" active-color="#FF780F" icon-size="35" :name="g_index" ></u-checkbox>
<image></image> <image :src="goods.goods_image"></image>
<view class="info"> <view class="info">
<view class="name u-line-2">木糖少女小紫薯西装领连衣裙夏季新款女装夏收腰格子格纹裙子</view> <view class="name u-line-2">{{ goods.goods_name }}</view>
<view class="cart-info"> <view class="cart-info">
<view class="price">99</view> <view class="price">{{ goods.goods_price }}</view>
<u-number-box :input-width="38" :input-height="39" :size="22" bg-color="#FFFFFF" color="#FF780F" :index="g_index" @minus="reduce($event, s_index)" @plus="plus($event, s_index)"></u-number-box> <u-number-box :input-width="38" :input-height="39" :size="22" bg-color="#FFFFFF" color="#FF780F" :index="g_index" @minus="reduce($event, s_index)" @plus="plus($event, s_index)" v-model="goods.goods_num"></u-number-box>
</view> </view>
</view> </view>
</view> </view>
@ -34,10 +34,10 @@
</u-checkbox-group> </u-checkbox-group>
<view class="total-price" v-if="status == '编辑'"> <view class="total-price" v-if="status == '编辑'">
<view class="title">合计</view> <view class="title">合计</view>
<view class="value">9.80</view> <view class="value">{{ totalPrice }}</view>
</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 == '完成'">删除</view> <view class="delete-btn" v-if="status == '完成'" @click="deleteGoods">删除</view>
</view> </view>
</view> </view>
</template> </template>
@ -46,55 +46,51 @@ export default {
data() { data() {
return { return {
status: '编辑', status: '编辑',
list: [ list: [],
{ checkedAll: false,
// checkedGoods: [],
member_id: 1, totalPrice: '0.00',
store_id: 1,
store_name: "官方自营店铺",
//
goods: [
{
//
checked: false
},
{
checked: false
}
],
checked: false
},
{
goods: [
{
checked: false
},
{
checked: false
}
],
checked: false
}
],
checkedAll: false
} }
}, },
onLoad() { watch: {
// this.getCartList(); list: {
handler(cart){
let checkedGoods = [];
cart.forEach(store => {
let temp = store.goods.filter(goods => {
return goods.checked;
})
checkedGoods = checkedGoods.concat(temp);
})
// console.log(checkedGoods);
this.checkedGoods = checkedGoods;
},
deep: true
}
},
onShow() {
this.getCartList();
}, },
methods: { methods: {
getCartList() { getCartList() {
this.$u.api.getCartTreeList().then((res)=>{ this.$u.api.getCartTreeList().then((res)=>{
if (res.errCode == 0) { if (res.errCode == 0) {
let cartList = [] let list = res.data.store_cart_list;
this.list = res.data.store_cart_list; list.forEach(item => {
// Object.assign(this, { checked }); Object.assign(item, { checked: false });
this.list.forEach(store => { item.goods.forEach(goods => {
store Object.assign(goods, { checked: false });
store.forEach(goods => {
}) })
}) })
// console.log(list);
this.list = list;
}
})
},
deleteGoods() {
let id = [];
this.$u.api.deleteCart({ id }).then(res => {
if (res.errCode == 0) {
} }
}) })
}, },
@ -173,6 +169,7 @@ export default {
currentWebview.setStyle({ currentWebview.setStyle({
titleNView: titleObj titleNView: titleObj
}); });
this.status = titleObj.buttons[0].text;
// #endif // #endif
} }
@ -200,7 +197,7 @@ export default {
width: 60rpx; width: 60rpx;
height: 60rpx; height: 60rpx;
border-radius: 50%; border-radius: 50%;
border: 1rpx solid #000; // border: 1rpx solid #000;
margin-right: 15rpx; margin-right: 15rpx;
} }
> view { > view {

View File

@ -6,32 +6,97 @@
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="title">昵称</view> <view class="title">昵称</view>
<view class="value">胖胖</view> <view class="value">
<input type="text" v-model="nickname" />
</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="title">性别</view> <view class="title">性别</view>
<view class="value"></view> <view class="value" @click="selectGender=true">{{ gender }}</view>
</view> </view>
<u-select v-model="selectGender" mode="single-column" :list="list" @confirm="setGender"></u-select>
<view class="info-item"> <view class="info-item">
<view class="title">生日</view> <view class="title">生日</view>
<view class="value">1998.10.13</view> <view class="value" @click="selectBirthday=true">{{ birthday }}</view>
</view> </view>
<u-picker mode="time" v-model="selectBirthday" :params="params" @confirm="setBirthday"></u-picker>
<view class="info-item phone" @click="updatePhone"> <view class="info-item phone" @click="updatePhone">
<view class="title">手机号</view> <view class="title">手机号</view>
<view class="value">18265906216</view> <view class="value">{{ phoneNumber }}</view>
<image src="../static/mine/21.png"></image> <image src="../static/mine/21.png"></image>
</view> </view>
</view> </view>
<view class="edit-tips">注意修改手机号需要原手机号获取验证码无原手机验证码请联系后台</view> <view class="edit-tips">注意修改手机号需要原手机号获取验证码无原手机验证码请联系后台</view>
<view class="edit-btn">完成</view> <view class="edit-btn" @click="updateMemberInfo">完成</view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return {} return {
selectGender: false,
selectBirthday: false,
list: [
{
value: 1,
label: '男'
},
{
value: 2,
label: '女'
}
],
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
},
nickname: '胖胖',
gender: '',
birthday: '',
phoneNumber: '',
}
},
onLoad() {
this.getUserInfo();
}, },
methods: { methods: {
getUserInfo() {
this.$u.api.getMemberInfo().then(res => {
if (res.errCode == 0) {
let userInfo = res.data.MemberArray;
[this.nickname, this.phoneNumber, this.birthday, this.gender, this.avatar] = [
userInfo.member_nickname,
userInfo.member_mobile,
userInfo.member_birthday,
userInfo.member_sex,
userInfo.member_avatar,
];
}
})
},
updateMemberInfo({ avatar = '' }) {
this.$u.api.updateMemberInfo({
nickname: this.nickname,
sex: this.gender,
avatar: avatar,
birthday: this.birthday,
}).then(res => {
if (res.errCode == 0) {
}
})
},
setGender(value) {
console.log(value);
this.gender = value[0].label;
},
setBirthday(value) {
// console.log(value);
this.birthday = value.year + '.' + value.month + '.' + value.day;
},
updatePhone() { updatePhone() {
uni.navigateTo({ uni.navigateTo({
url: '/pageE/mine/UpdatePhone' url: '/pageE/mine/UpdatePhone'
@ -71,7 +136,13 @@ export default {
color: rgba(51,51,51,1); color: rgba(51,51,51,1);
} }
.value { .value {
flex: 1;
height: 98rpx;
line-height: 98rpx;
color: rgba(102,102,102,1); color: rgba(102,102,102,1);
> input {
height: 98rpx;
}
} }
} }
.phone { .phone {

View File

@ -5,43 +5,55 @@
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="title">昵称</view> <view class="title">昵称</view>
<view class="value">胖胖</view> <view class="value">{{ userInfo.member_nickname }}</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="title">性别</view> <view class="title">性别</view>
<view class="value"></view> <view class="value">{{ userInfo.member_sex }}</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="title">生日</view> <view class="title">生日</view>
<view class="value">1998.10.13</view> <view class="value">{{ userInfo.member_birthday }}</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="title">手机号</view> <view class="title">手机号</view>
<view class="value">18265906216</view> <view class="value">{{ userInfo.member_mobile }}</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="title">等级</view> <view class="title">等级</view>
<view class="value">9999</view> <view class="value">{{ userInfo.member_exppoints }}</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="title">积分数</view> <view class="title">积分数</view>
<view class="value">9999</view> <view class="value">{{ userInfo.member_points }}</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="title">经验值</view> <view class="title">经验值</view>
<view class="value">9999</view> <view class="value">{{ userInfo.member_exppoints }}</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return {} return {
userInfo: {}
}
},
onLoad() {
this.getUserInfo();
}, },
onNavigationBarButtonTap() { onNavigationBarButtonTap() {
this.toEditPage(); this.toEditPage();
}, },
methods: { methods: {
getUserInfo() {
this.$u.api.getMemberInfo().then(res => {
if (res.errCode == 0) {
this.userInfo = res.data.MemberArray;
}
})
},
toEditPage() { toEditPage() {
uni.navigateTo({ uni.navigateTo({
url: '/pageE/mine/EditUserInfo' url: '/pageE/mine/EditUserInfo'

View File

@ -6,7 +6,7 @@
<swiper :current="swiperCurrent" @animationfinish="animationfinish"> <swiper :current="swiperCurrent" @animationfinish="animationfinish">
<swiper-item class="swiper-item"> <swiper-item class="swiper-item">
<scroll-view scroll-y class="order-list" @scrolltolower="reachBottom"> <scroll-view scroll-y class="order-list" @scrolltolower="reachBottom">
<u-empty text="订单为空" mode="order" color="#000000" v-if="!orderList.length"></u-empty> <u-empty text="暂无订单" mode="order" color="#000000" v-if="!orderList.length"></u-empty>
<view v-else> <view v-else>
<view v-for="(item, index) in orderList" :key="index" class="order-item"> <view v-for="(item, index) in orderList" :key="index" class="order-item">
<view class="order-title"> <view class="order-title">

View File

@ -5,15 +5,15 @@
<image src="/static/image/mine/23.png" class="avatar" @click="toOtherPage('/mine/MineInfo')" /> <image src="/static/image/mine/23.png" class="avatar" @click="toOtherPage('/mine/MineInfo')" />
<view class="user-info"> <view class="user-info">
<view class="info-left"> <view class="info-left">
<view class="user-nickname" @click="toOtherPage('/mine/MineInfo')">小同学</view> <view class="user-nickname" @click="toOtherPage('/mine/MineInfo')">{{ userInfo.member_nickname }}</view>
<view class="user-medal" @click="toOtherPage('/mine/MedalIntroduction')"> <view class="user-medal" @click="toOtherPage('/mine/MedalIntroduction')">
<img src="/static/image/mine/13.png" /> <img src="/static/image/mine/13.png" />
<view class="rank-title">勋章</view> <view class="rank-title">勋章</view>
</view> </view>
</view> </view>
<view class="info-right"> <view class="info-right">
<view class="info-phone">123***5694</view> <view class="info-phone">{{ userInfo.member_mobile | phoneFormat }}</view>
<view class="user-rank">等级:34</view> <view class="user-rank">等级:{{ userInfo.member_exppoints }}</view>
</view> </view>
</view> </view>
<view class="member-service" @click="toOtherPage('/mine/MemberServe')">会员服务</view> <view class="member-service" @click="toOtherPage('/mine/MemberServe')">会员服务</view>
@ -32,7 +32,7 @@
<view>图文收藏</view> <view>图文收藏</view>
</view> </view>
<view @click="toOtherPage('/mine/Integral')"> <view @click="toOtherPage('/mine/Integral')">
<view>9</view> <view>{{ userInfo.member_points }}</view>
<view>积分数</view> <view>积分数</view>
</view> </view>
<view @click="toOtherPage('/mine/MineConcerns')"> <view @click="toOtherPage('/mine/MineConcerns')">
@ -123,15 +123,28 @@
export default { export default {
data() { data() {
return { return {
title: "2" userInfo: {}
}; };
}, },
onLoad() {}, filters: {
phoneFormat(value) {
return value.replace(/^(\d{3})\d*(\d{4})$/, '$1****$2');
}
},
onLoad() {
this.getUserInfo();
},
onNavigationBarButtonTap() { onNavigationBarButtonTap() {
console.log("setting");
this.toOtherPage("/setting/Index"); this.toOtherPage("/setting/Index");
}, },
methods: { methods: {
getUserInfo() {
this.$u.api.getMemberInfo().then(res => {
if (res.errCode == 0) {
this.userInfo = res.data.MemberArray;
}
})
},
toOtherPage(url) { toOtherPage(url) {
// console.log(url); // console.log(url);
uni.navigateTo({ uni.navigateTo({
@ -146,7 +159,7 @@ export default {
min-height: calc(calc(100vh - var(--window-top)) - 50px); min-height: calc(calc(100vh - var(--window-top)) - 50px);
background: #ECECEC; background: #ECECEC;
.mine-top { .mine-top {
width: 750rpx; // width: 100%;
height: 272rpx; height: 272rpx;
background: #FF780F; background: #FF780F;
.top { .top {
@ -173,7 +186,7 @@ export default {
} }
.user-medal { .user-medal {
display: flex; display: flex;
// width: 87rpx; width: 110rpx;
// height: 25rpx; // height: 25rpx;
background: linear-gradient(269deg,rgba(175,175,175,1) 0%,rgba(224,224,224,1) 100%); background: linear-gradient(269deg,rgba(175,175,175,1) 0%,rgba(224,224,224,1) 100%);
border-radius: 13rpx; border-radius: 13rpx;