Merge pull request 'update api' (#35) from zhy into master
Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/35
This commit is contained in:
commit
1e7ac7bc05
@ -19,6 +19,19 @@ export default {
|
||||
getCartTreeList() {
|
||||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,9 +175,21 @@ export default {
|
||||
// 店铺收藏列表
|
||||
getStoreFavoritesList({ type }) {
|
||||
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,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@
|
||||
商品推荐
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>分类名称</text>
|
||||
<text v-for="item in classifyList" :key="item.gc_id">{{ item.gc_name }}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="item">
|
||||
<image :src="$u.http.config.baseUrl + info.goods_image" class="img"></image>
|
||||
<view class="item" @click="addCart">
|
||||
<image :src="info.goods_image" class="img"></image>
|
||||
<view class="info">
|
||||
<text class="title u-line-1">{{ info.goods_name }}</text>
|
||||
<text class="jianjie u-line-2">{{ info.goods_advword }}</text>
|
||||
@ -13,7 +13,20 @@ export default {
|
||||
name:"item",
|
||||
props: {
|
||||
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>
|
||||
<style lang="scss" scoped>
|
||||
|
@ -5,20 +5,20 @@
|
||||
<view class="store">
|
||||
<u-checkbox v-model="store.checked" shape="circle" active-color="#FF780F" icon-size="35" :name="s_index" @change="storeaAloneChange"></u-checkbox>
|
||||
<view class="name">
|
||||
<image></image>
|
||||
<view>胖胖的店</view>
|
||||
<image :src="store.store_avatar"></image>
|
||||
<view>{{ store.store_name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods">
|
||||
<u-checkbox-group @change="goodsChange($event, s_index)">
|
||||
<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>
|
||||
<image></image>
|
||||
<image :src="goods.goods_image"></image>
|
||||
<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="price">¥99</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>
|
||||
<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)" v-model="goods.goods_num"></u-number-box>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -34,10 +34,10 @@
|
||||
</u-checkbox-group>
|
||||
<view class="total-price" v-if="status == '编辑'">
|
||||
<view class="title">合计:</view>
|
||||
<view class="value">¥9.80</view>
|
||||
<view class="value">¥{{ totalPrice }}</view>
|
||||
</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>
|
||||
</template>
|
||||
@ -46,55 +46,51 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
status: '编辑',
|
||||
list: [
|
||||
{
|
||||
// 店铺信息
|
||||
member_id: 1,
|
||||
store_id: 1,
|
||||
store_name: "官方自营店铺",
|
||||
// 店铺下的商品列表
|
||||
goods: [
|
||||
{
|
||||
// 商品信息
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
checked: false
|
||||
}
|
||||
],
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
goods: [
|
||||
{
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
checked: false
|
||||
}
|
||||
],
|
||||
checked: false
|
||||
}
|
||||
],
|
||||
checkedAll: false
|
||||
list: [],
|
||||
checkedAll: false,
|
||||
checkedGoods: [],
|
||||
totalPrice: '0.00',
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// this.getCartList();
|
||||
watch: {
|
||||
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: {
|
||||
getCartList() {
|
||||
this.$u.api.getCartTreeList().then((res)=>{
|
||||
if (res.errCode == 0) {
|
||||
let cartList = []
|
||||
this.list = res.data.store_cart_list;
|
||||
// Object.assign(this, { checked });
|
||||
this.list.forEach(store => {
|
||||
store
|
||||
store.forEach(goods => {
|
||||
|
||||
let list = res.data.store_cart_list;
|
||||
list.forEach(item => {
|
||||
Object.assign(item, { checked: false });
|
||||
item.goods.forEach(goods => {
|
||||
Object.assign(goods, { checked: false });
|
||||
})
|
||||
})
|
||||
// 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({
|
||||
titleNView: titleObj
|
||||
});
|
||||
this.status = titleObj.buttons[0].text;
|
||||
// #endif
|
||||
|
||||
}
|
||||
@ -200,7 +197,7 @@ export default {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 50%;
|
||||
border: 1rpx solid #000;
|
||||
// border: 1rpx solid #000;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
> view {
|
||||
|
@ -6,32 +6,97 @@
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="title">昵称</view>
|
||||
<view class="value">胖胖</view>
|
||||
<view class="value">
|
||||
<input type="text" v-model="nickname" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="title">性别</view>
|
||||
<view class="value">女</view>
|
||||
<view class="value" @click="selectGender=true">{{ gender }}</view>
|
||||
</view>
|
||||
<u-select v-model="selectGender" mode="single-column" :list="list" @confirm="setGender"></u-select>
|
||||
<view class="info-item">
|
||||
<view class="title">生日</view>
|
||||
<view class="value">1998.10.13</view>
|
||||
<view class="value" @click="selectBirthday=true">{{ birthday }}</view>
|
||||
</view>
|
||||
<u-picker mode="time" v-model="selectBirthday" :params="params" @confirm="setBirthday"></u-picker>
|
||||
<view class="info-item phone" @click="updatePhone">
|
||||
<view class="title">手机号</view>
|
||||
<view class="value">18265906216</view>
|
||||
<view class="value">{{ phoneNumber }}</view>
|
||||
<image src="../static/mine/21.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="edit-tips">注意:修改手机号需要原手机号获取验证码,无原手机验证码,请联系后台</view>
|
||||
<view class="edit-btn">完成</view>
|
||||
<view class="edit-btn" @click="updateMemberInfo">完成</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
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: {
|
||||
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() {
|
||||
uni.navigateTo({
|
||||
url: '/pageE/mine/UpdatePhone'
|
||||
@ -71,7 +136,13 @@ export default {
|
||||
color: rgba(51,51,51,1);
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
height: 98rpx;
|
||||
line-height: 98rpx;
|
||||
color: rgba(102,102,102,1);
|
||||
> input {
|
||||
height: 98rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.phone {
|
||||
|
@ -5,43 +5,55 @@
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="title">昵称</view>
|
||||
<view class="value">胖胖</view>
|
||||
<view class="value">{{ userInfo.member_nickname }}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="title">性别</view>
|
||||
<view class="value">女</view>
|
||||
<view class="value">{{ userInfo.member_sex }}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="title">生日</view>
|
||||
<view class="value">1998.10.13</view>
|
||||
<view class="value">{{ userInfo.member_birthday }}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="title">手机号</view>
|
||||
<view class="value">18265906216</view>
|
||||
<view class="value">{{ userInfo.member_mobile }}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="title">等级</view>
|
||||
<view class="value">9999</view>
|
||||
<view class="value">{{ userInfo.member_exppoints }}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="title">积分数</view>
|
||||
<view class="value">9999</view>
|
||||
<view class="value">{{ userInfo.member_points }}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="title">经验值</view>
|
||||
<view class="value">9999</view>
|
||||
<view class="value">{{ userInfo.member_exppoints }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {}
|
||||
return {
|
||||
userInfo: {}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getUserInfo();
|
||||
},
|
||||
onNavigationBarButtonTap() {
|
||||
this.toEditPage();
|
||||
},
|
||||
methods: {
|
||||
getUserInfo() {
|
||||
this.$u.api.getMemberInfo().then(res => {
|
||||
if (res.errCode == 0) {
|
||||
this.userInfo = res.data.MemberArray;
|
||||
}
|
||||
})
|
||||
},
|
||||
toEditPage() {
|
||||
uni.navigateTo({
|
||||
url: '/pageE/mine/EditUserInfo'
|
||||
|
@ -6,7 +6,7 @@
|
||||
<swiper :current="swiperCurrent" @animationfinish="animationfinish">
|
||||
<swiper-item class="swiper-item">
|
||||
<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-for="(item, index) in orderList" :key="index" class="order-item">
|
||||
<view class="order-title">
|
||||
|
@ -5,15 +5,15 @@
|
||||
<image src="/static/image/mine/23.png" class="avatar" @click="toOtherPage('/mine/MineInfo')" />
|
||||
<view class="user-info">
|
||||
<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')">
|
||||
<img src="/static/image/mine/13.png" />
|
||||
<view class="rank-title">勋章</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-right">
|
||||
<view class="info-phone">123***5694</view>
|
||||
<view class="user-rank">等级:34级</view>
|
||||
<view class="info-phone">{{ userInfo.member_mobile | phoneFormat }}</view>
|
||||
<view class="user-rank">等级:{{ userInfo.member_exppoints }}级</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="member-service" @click="toOtherPage('/mine/MemberServe')">会员服务</view>
|
||||
@ -32,7 +32,7 @@
|
||||
<view>图文收藏</view>
|
||||
</view>
|
||||
<view @click="toOtherPage('/mine/Integral')">
|
||||
<view>9</view>
|
||||
<view>{{ userInfo.member_points }}</view>
|
||||
<view>积分数</view>
|
||||
</view>
|
||||
<view @click="toOtherPage('/mine/MineConcerns')">
|
||||
@ -123,15 +123,28 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
title: "2"
|
||||
userInfo: {}
|
||||
};
|
||||
},
|
||||
onLoad() {},
|
||||
},
|
||||
filters: {
|
||||
phoneFormat(value) {
|
||||
return value.replace(/^(\d{3})\d*(\d{4})$/, '$1****$2');
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getUserInfo();
|
||||
},
|
||||
onNavigationBarButtonTap() {
|
||||
console.log("setting");
|
||||
this.toOtherPage("/setting/Index");
|
||||
},
|
||||
methods: {
|
||||
getUserInfo() {
|
||||
this.$u.api.getMemberInfo().then(res => {
|
||||
if (res.errCode == 0) {
|
||||
this.userInfo = res.data.MemberArray;
|
||||
}
|
||||
})
|
||||
},
|
||||
toOtherPage(url) {
|
||||
// console.log(url);
|
||||
uni.navigateTo({
|
||||
@ -146,7 +159,7 @@ export default {
|
||||
min-height: calc(calc(100vh - var(--window-top)) - 50px);
|
||||
background: #ECECEC;
|
||||
.mine-top {
|
||||
width: 750rpx;
|
||||
// width: 100%;
|
||||
height: 272rpx;
|
||||
background: #FF780F;
|
||||
.top {
|
||||
@ -173,7 +186,7 @@ export default {
|
||||
}
|
||||
.user-medal {
|
||||
display: flex;
|
||||
// width: 87rpx;
|
||||
width: 110rpx;
|
||||
// height: 25rpx;
|
||||
background: linear-gradient(269deg,rgba(175,175,175,1) 0%,rgba(224,224,224,1) 100%);
|
||||
border-radius: 13rpx;
|
||||
|
Loading…
Reference in New Issue
Block a user