Browse Source

2023-02-23

功能完善
master
guoxing 2 years ago
parent
commit
932ebc04c7
  1. 3
      mallplusui-uniapp-app/common/api.js
  2. 30
      mallplusui-uniapp-app/components/coolc-coupon/coolc-coupon.vue
  3. 28
      mallplusui-uniapp-app/pages/index/index.vue
  4. 209
      mallplusui-uniapp-app/pages/index/user.vue
  5. 4
      mallplusui-uniapp-app/pagesA/product/list.vue
  6. 2
      mallplusui-uniapp-app/pagesU/user/coupon.vue
  7. 4
      mallplusui-uniapp-app/store/index.js

3
mallplusui-uniapp-app/common/api.js

@ -313,6 +313,7 @@ export default {
return res.data.data;
} else {
console.log(">>>>>=");
console.log(">>>>>=",res.data);
if (res.data) {
if (!res.data.msg) {
res.data.msg = res.data.data;
@ -321,7 +322,7 @@ export default {
title: res.data.msg,
icon: 'none'
});
this.$api.msg(res.data.msg);
// this.$api.msg(res.data.msg);
}
}

30
mallplusui-uniapp-app/components/coolc-coupon/coolc-coupon.vue

@ -8,10 +8,10 @@
<view class="demand">{{ item.minPoint }} {{ item.amount }}</view>
</view>
</view>
<view class="get-btn" v-if="!types" :style="{color:color, borderColor:color, background:solid}"
<view class="get-btn" :style="{color:color, borderColor:color, background:solid}"
@click="acceptCoupon(item)">立即领取</view>
<navigator class="get-btn" v-if="types" :style="{color:color, borderColor:color, background:solid}"
:url='item.url' @click="useCoupon(item)">立即使用</navigator>
<!-- <navigator class="get-btn" v-if="types" :style="{color:color, borderColor:color, background:solid}"
:url='item.url' @click="useCoupon(item)">立即使用</navigator> -->
</view>
</template>
@ -21,6 +21,9 @@
import {
formatDate
} from '@/common/date';
import {
mapState
} from 'vuex';
export default {
components: {
@ -54,8 +57,12 @@
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
},
computed: {
...mapState(['hasLogin', 'userInfo']),
},
methods: {
async acceptCoupon(item) {
if (this.hasLogin) {
this.types = !this.types
uni.showLoading({
title: '请稍后'
@ -64,15 +71,20 @@
let params = {
couponId: item.id
};
let data = await Api.apiCall('post', Api.index.acceptCoupon, params);
console.log(data);
if (data) {
this.$api.msg(data);
this.clickSubMethod(item)
// let data = await Api.apiCall('post', Api.index.acceptCoupon, params);
// console.log("data?????", data);
// if (data) {
// // this.$api.msg(data);
// this.clickSubMethod(item)
}
// }
uni.hideLoading();
} else {
uni.navigateTo({
url: '/pages/public/login'
});
}
},
clickSubMethod(vel) {
console.log('clickSubMethod')

28
mallplusui-uniapp-app/pages/index/index.vue

@ -360,19 +360,35 @@
}
},
},
computed: {
...mapState(['hasLogin', 'userInfo']),
},
methods: {
clickParentMethod() {
console.log('clickParentMethod')
this.$refs.SubComponent.callSubMethod()
},
callParentMethod(val) {
let info = val
console.log('callParentMethod: ' + val)
console.log('val: ' + val.id)
console.log('val: ' + info.id)
// listfunctionitem
var index = this.couponList.findIndex(function(item) {
return item.id == val.id;
var index = this.couponList.findIndex(
// function(item) {
// console.log('item: ' + JSON.stringify(item))
// console.log('val: ' + val)
// return item.id == val.id;
item => {
console.log('item: ' + JSON.stringify(item).id)
console.log('val: ' + val.id)
if (item == val) {
return true
}
})
console.log('index: ' + index)
this.couponList.splice(index, 1);
// this.getCouponList();
},
async sysInfoMethod() {
@ -526,7 +542,7 @@
}
},
/**
* 获取轮播图
* 获取优惠券
*/
async getCouponList() {
let params = {
@ -536,7 +552,9 @@
if (data) {
console.log("优惠券")
console.log("优惠券", data)
this.couponList = data || [];
console.log("优惠券id",data[0].id)
this.couponList = []
this.couponList = this.couponList.concat(data) || [];
}
},
/**

209
mallplusui-uniapp-app/pages/index/user.vue

@ -6,21 +6,30 @@
<view class="member-top-c">
<template v-if="userDetailInfo && userDetailInfo.id">
<view class="" style="display: flex;align-items: center;">
<image class="portrait" mode="aspectFill" :src="userDetailInfo.icon" @click="toUserInfo"></image>
<view class="user-name" style="margin-left: 10upx;color: #FFFFFF;" @click="toUserInfo">{{ userDetailInfo.nickname || userDetailInfo.username }}</view>
<view v-if="userDetailInfo.storeId" class="vip-card-box1" @click="toNav('../../pagesC/seller/index')"><view class="b-btn">卖家中心</view></view>
<image class="portrait" mode="aspectFill" :src="userDetailInfo.icon" @click="toUserInfo">
</image>
<view class="user-name" style="margin-left: 10upx;color: #FFFFFF;" @click="toUserInfo">
{{ userDetailInfo.nickname || userDetailInfo.username }}
</view>
<view v-if="userDetailInfo.storeId" class="vip-card-box1"
@click="toNav('../../pagesC/seller/index')">
<view class="b-btn">卖家中心</view>
</view>
</view>
</template>
<template v-else>
<!-- #ifdef H5 || APP-PLUS -->
<image class="portrait" mode="aspectFill" src="/static/missing-face.png" @click="toLogin"></image>
<image class="portrait" mode="aspectFill" src="/static/missing-face.png" @click="toLogin">
</image>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<image class="portrait" mode="aspectFill" src="/static/missing-face.png" @click="toWeChatLogin"></image>
<image class="portrait" mode="aspectFill" src="/static/missing-face.png" @click="toWeChatLogin">
</image>
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<view class="portrait"></view>
<view><button class="login-btn" open-type="getAuthorize" @click="getALICode" hover-class="btn-hover">授权登录</button></view>
<view><button class="login-btn" open-type="getAuthorize" @click="getALICode"
hover-class="btn-hover">授权登录</button></view>
<!-- #endif -->
</template>
</view>
@ -37,23 +46,17 @@
</view>
</view>
<view
class="cover-container"
:style="[
<view class="cover-container" :style="[
{
transform: coverTransform,
transition: coverTransition
}
]"
@touchstart="coverTouchstart"
@touchmove="coverTouchmove"
@touchend="coverTouchend"
>
]" @touchstart="coverTouchstart" @touchmove="coverTouchmove" @touchend="coverTouchend">
<image class="arc" src="/static/arc.png"></image>
<view class="tj-sction">
<view class="tj-item" @click="toNav('../../pagesU/user/deposit')">
<text class="num">{{ userDetailInfo.blance || 0 }}</text>
<text class="num">{{ userDetailInfo.blance || 0}}</text>
<text>余额</text>
</view>
<view class="tj-item" @click="toNav('../../pagesU/user/coupon')">
@ -67,20 +70,24 @@
</view>
<!-- 订单 -->
<view class="order-section">
<view class="order-item" @click="navTo('/pages/order/order?status=0')" hover-class="common-hover" :hover-stay-time="50">
<view class="order-item" @click="navTo('/pages/order/order?status=0')" hover-class="common-hover"
:hover-stay-time="50">
<text class="yticon icon-shouye"></text>
<text>全部订单</text>
</view>
<view class="order-item" @click="navTo('/pages/order/order?status=2')" hover-class="common-hover" :hover-stay-time="50">
<view class="order-item" @click="navTo('/pages/order/order?status=2')" hover-class="common-hover"
:hover-stay-time="50">
<text class="yticon icon-daifukuan"></text>
<text>待付款</text>
</view>
<view class="order-item" @click="navTo('/pages/order/order?status=3')" hover-class="common-hover" :hover-stay-time="50">
<view class="order-item" @click="navTo('/pages/order/order?status=3')" hover-class="common-hover"
:hover-stay-time="50">
<text class="yticon icon-yishouhuo"></text>
<text>待收货</text>
</view>
<view class="order-item" @click="navTo('../../pagesA/after_sale/list')" hover-class="common-hover" :hover-stay-time="50">
<view class="order-item" @click="navTo('../../pagesA/after_sale/list')" hover-class="common-hover"
:hover-stay-time="50">
<text class="yticon icon-shouhoutuikuan"></text>
<text>退款/售后</text>
</view>
@ -92,14 +99,18 @@
<text>浏览历史</text>
</view>
<scroll-view scroll-x class="h-list" v-if="viewList && viewList.length > 0">
<image v-for="(item, index) in viewList" :key="index" @click="navToDetailPage(item)" :src="item.pic" mode="aspectFill"></image>
<image v-for="(item, index) in viewList" :key="index" @click="navToDetailPage(item)" :src="item.pic"
mode="aspectFill"></image>
</scroll-view>
<!--<list-cell icon="icon-iconfontweixin" iconColor="#e07472" title="我的钱包" tips="您的会员还有3天过期"></list-cell>-->
<list-cell icon="icon-dizhi" iconColor="#5fcda2" title="地址管理" @eventClick="navTo('../../pagesU/address/address')"></list-cell>
<list-cell icon="icon-tuandui" iconColor="#EE82EE" title="个人资料" @eventClick="navTo('../../pagesU/user/profile')"></list-cell>
<list-cell icon="icon-dizhi" iconColor="#5fcda2" title="地址管理"
@eventClick="navTo('../../pagesU/address/address')"></list-cell>
<list-cell icon="icon-tuandui" iconColor="#EE82EE" title="个人资料"
@eventClick="navTo('../../pagesU/user/profile')"></list-cell>
<!--<list-cell icon="icon-share" iconColor="#9789f7" title="分享" tips="邀请好友赢10万大礼"></list-cell>
<list-cell icon="icon-pinglun-copy" iconColor="#ee883b" title="晒单" tips="晒单抢红包"></list-cell>-->
<list-cell icon="icon-shoucang_xuanzhongzhuangtai" iconColor="#54b4ef" title="我的收藏" @eventClick="navTo('../../pagesU/user/collect')"></list-cell>
<list-cell icon="icon-shoucang_xuanzhongzhuangtai" iconColor="#54b4ef" title="我的收藏"
@eventClick="navTo('../../pagesU/user/collect')"></list-cell>
<!-- <list-cell
icon="icon-share cgtt"
iconColor="#0e68d7"
@ -137,7 +148,8 @@
@eventClick="navTo('../../pagesU/user/invite')"
></list-cell> -->
<!-- <list-cell icon="icon-pinglun-copy" iconColor="#0e68d7" v-if="!userDetailInfo.invitecode" title="推荐邀请码" @eventClick="inputShowModal('invitecode')"></list-cell> -->
<list-cell icon="icon-shezhi1" iconColor="#e07472" title="系统设置" border="" @eventClick="navTo('/pages/set/set')"></list-cell>
<list-cell icon="icon-shezhi1" iconColor="#e07472" title="系统设置" border=""
@eventClick="navTo('/pages/set/set')"></list-cell>
<!-- <list-cell icon="icon-shezhi1" iconColor="#e07472" title="test" border="" @eventClick="navTo('/pages/search/test')"></list-cell> -->
</view>
</view>
@ -147,15 +159,18 @@
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import listCell from '@/components/mix-list-cell';
import neilModal from '@/components/neil-modal.vue';
import { mapState, mapMutations } from 'vuex';
let startY = 0,
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import listCell from '@/components/mix-list-cell';
import neilModal from '@/components/neil-modal.vue';
import {
mapState,
mapMutations
} from 'vuex';
let startY = 0,
moveY = 0,
pageAtTop = true;
export default {
export default {
components: {
mallplusCopyright,
listCell,
@ -180,9 +195,15 @@ export default {
},
async onLoad() {
this.userDetailInfo = {}
this.couponList = []
this.viewList = []
this.getData();
},
async onShow() {
this.userDetailInfo = {}
this.couponList = []
this.viewList = []
this.getData();
},
@ -232,7 +253,9 @@ export default {
that.$api.msg('输入不能为空');
return;
}
let obj = { id: this.userDetailInfo.id };
let obj = {
id: this.userDetailInfo.id
};
obj[that.feild] = that.inputContent;
Api.apiCall('post', Api.member.updateMember, obj);
that.$api.msg('修改成功');
@ -249,10 +272,15 @@ export default {
if (!data1) {
this.userDetailInfo = {};
}
this.userDetailInfo = data1.member;
console.log("data", data1);
if (!data1.member) {
this.logout();
this.couponList = []
this.viewList = []
this.getHistory();
} else {
this.userDetailInfo = data1.member;
uni.setStorageSync('userInfos', data1.member);
console.log(this.userDetailInfo);
let couponList = data1.histories;
@ -269,8 +297,21 @@ export default {
},
toNav(url) {
uni.navigateTo({
url: url
// if (!this.hasLogin) {
// url = '/pages/public/login';
// }
// uni.navigateTo({
// url: url
// });
uni.showModal({
title: '提示',
content: '已经是最新版本',
showCancel:false,
success: function(res) {
if (res.confirm) {
}
}
});
},
toUserInfo() {
@ -515,52 +556,56 @@ export default {
// #endif
}
}
};
};
</script>
<style lang="scss">
@font-face {
@font-face {
font-family: cgtt;
font-weight: normal;
font-style: normal;
src: url('//at.alicdn.com/t/font_1475801_5innv59qqcr.ttf') format('truetype');
}
page {
}
page {
background: #f3f3f3;
}
.cgtt {
}
.cgtt {
font-family: 'cgtt' !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
.icon-userShare:before {
.icon-userShare:before {
content: '\c600';
}
}
.icon-userJoin:before {
.icon-userJoin:before {
content: '\c601';
}
}
%flex-center {
%flex-center {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
%section {
}
%section {
display: flex;
justify-content: space-around;
align-content: center;
background: #fff;
border-radius: 10upx;
}
}
.user-section {
.user-section {
height: 520upx;
padding: 100upx 30upx 0;
position: relative;
.bg {
position: absolute;
left: 0;
@ -570,26 +615,30 @@ page {
filter: blur(1px);
// opacity: 0.7;
}
}
.user-info-box {
}
.user-info-box {
height: 180upx;
display: flex;
align-items: center;
position: relative;
z-index: 1;
.portrait {
width: 130upx;
height: 130upx;
border: 5upx solid #fff;
border-radius: 50%;
}
.username {
font-size: $font-lg + 6upx;
color: $font-color-dark;
margin-left: 20upx;
}
}
.login-btn {
}
.login-btn {
color: #fff;
width: 180upx;
height: 50upx;
@ -597,8 +646,9 @@ page {
border-radius: 25upx;
background: #ff7159;
font-size: 12px;
}
.vip-card-box {
}
.vip-card-box {
display: flex;
flex-direction: column;
color: #f7d680;
@ -608,6 +658,7 @@ page {
overflow: hidden;
position: relative;
padding: 20upx 24upx;
.card-bg {
position: absolute;
top: 20upx;
@ -615,6 +666,7 @@ page {
width: 380upx;
height: 260upx;
}
.b-btn {
position: absolute;
right: 20upx;
@ -629,22 +681,26 @@ page {
background: linear-gradient(left, #f9e6af, #ffd465);
z-index: 1;
}
.tit {
font-size: $font-base + 2upx;
color: #f7d680;
margin-bottom: 28upx;
.yticon {
color: #f6e5a3;
margin-right: 16upx;
}
}
.e-b {
font-size: $font-sm;
color: #d8cba9;
margin-top: 10upx;
}
}
.vip-card-box1 {
}
.vip-card-box1 {
display: flex;
flex-direction: column;
color: #f7d680;
@ -670,28 +726,33 @@ page {
background: linear-gradient(left, #f9e6af, #ffd465);
z-index: 1;
}
.tit {
font-size: $font-base + 2upx;
color: #f7d680;
margin-bottom: 28upx;
.yticon {
color: #f6e5a3;
margin-right: 16upx;
}
}
.e-b {
font-size: $font-sm;
color: #d8cba9;
margin-top: 10upx;
}
}
.cover-container {
}
.cover-container {
background: $page-color-base;
margin-top: -150upx;
padding: 0 20upx;
position: relative;
background: #f5f5f5;
padding-bottom: 20upx;
.arc {
position: absolute;
left: 0;
@ -699,9 +760,11 @@ page {
width: 100%;
height: 36upx;
}
}
.tj-sction {
}
.tj-sction {
@extend %section;
.tj-item {
@extend %flex-center;
flex-direction: column;
@ -709,16 +772,19 @@ page {
font-size: $font-sm;
color: #75787d;
}
.num {
font-size: $font-lg;
color: $font-color-dark;
margin-bottom: 8upx;
}
}
.order-section {
}
.order-section {
@extend %section;
padding: 28upx 0;
margin-top: 20upx;
.order-item {
@extend %flex-center;
width: 120upx;
@ -727,20 +793,24 @@ page {
font-size: $font-sm;
color: $font-color-dark;
}
.yticon {
font-size: 48upx;
margin-bottom: 18upx;
color: #fa436a;
}
.icon-shouhoutuikuan {
font-size: 44upx;
}
}
.history-section {
}
.history-section {
padding: 30upx 0 0;
margin-top: 20upx;
background: #fff;
border-radius: 10upx;
.sec-header {
display: flex;
align-items: center;
@ -748,6 +818,7 @@ page {
color: $font-color-dark;
line-height: 40upx;
margin-left: 30upx;
.yticon {
font-size: 44upx;
color: #5eba8f;
@ -755,9 +826,11 @@ page {
line-height: 40upx;
}
}
.h-list {
white-space: nowrap;
padding: 30upx 30upx 0;
image {
display: inline-block;
width: 160upx;
@ -766,5 +839,5 @@ page {
border-radius: 10upx;
}
}
}
}
</style>

4
mallplusui-uniapp-app/pagesA/product/list.vue

@ -20,8 +20,8 @@
<view class="image-wrapper"><image :src="item.pic" mode="aspectFill"></image></view>
<text class="title clamp">{{ item.name }}</text>
<view class="price-box" >
<text class="price">{{ item.price }}</text>
<text class="price2">市场价 ¥{{ item.originalPrice }}</text>
<text class="price">{{ item.originalPrice }}</text>
<text class="price2">市场价 ¥{{ item.price }}</text>
</view>
<!-- <view class="price-box" v-if="item.isVip == 1">
<text class="price">会员价{{ item.vipPrice }}</text>

2
mallplusui-uniapp-app/pagesU/user/coupon.vue

@ -158,7 +158,7 @@ import Api from '@/common/api';
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
return formatDate(date, 'yyyy-MM-dd')
},
},
methods: {

4
mallplusui-uniapp-app/store/index.js

@ -6,13 +6,16 @@ Vue.use(Vuex)
const store = new Vuex.Store({
state: {
hasLogin: false,
hasVip: false,
userInfo: ''
},
mutations: {
login(state, provider) {
console.log(provider);
if (provider && provider != undefined) {
console.log("provider",provider);
state.hasLogin = true;
state.hasVip = true;
uni.setStorage({ //缓存用户登陆状态
key: 'userInfo',
data: provider.userInfo
@ -24,6 +27,7 @@ const store = new Vuex.Store({
},
logout(state) {
state.hasLogin = false;
state.hasVip = false;
state.userInfo = '';
uni.removeStorage({
key: 'userInfo'

Loading…
Cancel
Save