meliuxy 4 years ago
parent f6d94b3724
commit 1964c5390b

BIN
.DS_Store vendored

Binary file not shown.

3
.gitignore vendored

@ -1,2 +1,3 @@
.hbuilderx
/unpackage
/unpackage
config.js

@ -1,6 +1,6 @@
export const appConfig = {
appId: 'wx9b4762770771d98a',
//baseUrl: 'https://yunyubang2021.langye.net',
// baseUrl: 'http://yunyubang.localhost.com',
baseUrl:'https://yunyubang2021.langye.net',
openidInfoKey: 'openid_info_yunyubang'
}

@ -1,25 +1,28 @@
<template>
<view class="content">
<view class="memberBanner"><image mode="widthFix" src="../../static/memberBanner.jpg"></image></view>
<view class="memberBanner">
<image mode="widthFix" src="../../static/memberBanner.jpg"></image>
</view>
<view class="buyBox">
<view class="title">请输入您的联系方式</view>
<view class="formCol">
<view>宝妈姓名<text style="color:red">*</text></view>
<view class="formRight"><input type="text" v-model="info.memberName" placeholder="宝妈姓名"></view>
<view class="formRight"><input type="text" v-model="info.member_name" placeholder="宝妈姓名"></view>
</view>
<view class="formCol">
<view>手机号码<text style="color:red">*</text></view>
<view class="formRight"><input type="text" v-model="info.phone" placeholder="请输入手机号码"></view>
<view class="formRight"><input type="text" v-model="info.phone" placeholder="请输入手机号码"></view>
</view>
<view class="formCol">
<view>宝宝生日/预产期<text style="color:red">*</text></view>
<view class="formRight">
<picker mode="date" :value="info.dueDate" :start="startDate" :end="endDate" @change="bindDateChange">
<view class="uni-input">{{info.dueDate}}</view>
</picker>
<picker mode="date" :value="info.due_date" :start="startDate" :end="endDate"
@change="bindDateChange">
<view class="uni-input">{{info.due_date}}</view>
</picker>
</view>
</view>
<view class="formCol">
<!-- <view class="formCol" >
<view>免费福利</view>
<view class="formRight">
<checkbox-group class="checkGroup">
@ -31,14 +34,16 @@
</label>
</checkbox-group>
</view>
</view>
</view> -->
</view>
<view class="payBtn" @click="pay"></view>
</view>
</template>
<script>
import {weixin} from '../../../../utils/weixin.js'
import {
weixin
} from '../../../../utils/weixin.js'
export default {
data() {
const currentDate = this.getDate({
@ -46,10 +51,11 @@
})
return {
info: {
dueDate: currentDate,
due_date: currentDate,
token: '',
phone: '',
productId: ''
product_id: '',
product_type:'package'
},
token: '',
openid: '',
@ -59,51 +65,72 @@
onLoad(options) {
const phone_token = uni.getStorageSync('phone_token')
this.info.phone = phone_token.phone
this.token = phone_token.token
let user_info = weixin.getUserInfoCache()
this.openid = user_info.openid
this.info.productId = options.package_id
this.info.product_id = options.package_id;
this.info.promotion = uni.getStorageSync("base_promotion_id");
},
methods: {
pay() {
if (!this.info.memberName) {
if (!this.info.member_name) {
this.alert('请输入宝妈姓名')
return
}
if (!this.info.dueDate) {
this.alert('请选择日期')
if (!this.info.due_date) {
this.alert('请选择预产日期')
return
}
}
if (!this.info.phone) {
this.alert('请填写手机号')
return
}
this.reqByToken('/api/member/order-add', this.info, r => {
uni.showLoading({title: '加载中',mask:true});
uni.request({
url: this.baseUrl + '/api/member/order-payment',
method: 'GET',
data: {
token: this.token,
order_id: r.id,
openid: this.openid
},
success: res => {
setTimeout(function () {uni.hideLoading();}, 100);
let payParams = JSON.parse(res.data.jsApiParameters)
payParams.provider = 'wxpay'
payParams.success = result => {
uni.navigateTo({
url: '../buyMemberSuccess/buyMemberSuccess'
})
}
payParams.fail = result => {
console.log(result);
weixin.request({
api: '/api/member/order-add',
method: 'POST',
data: this.info,
utilSuccess: r => {
weixin.request({
api: '/api/member/order-payment',
method: 'GET',
data: {
order_id: r.data.id,
openid: this.openid
},
utilSuccess: res => {
setTimeout(function() {
uni.hideLoading();
}, 100);
let payParams = JSON.parse(res.jsApiParameters)
payParams.provider = 'wxpay'
payParams.success = result => {
uni.navigateTo({
url: '../buyMemberSuccess/buyMemberSuccess'
})
}
payParams.fail = result => {
console.log(result);
}
wx.requestPayment(payParams);
},
utilFail: res => {
console.log(res);
}
wx.requestPayment(payParams);
}
})
})
},
utilFail: r => {
console.log(r);
}
})
},
bindDateChange: function(e) {
this.info.dueDate = e.target.value
this.info.due_date = e.target.value
},
getDate(type) {
const date = new Date();
@ -119,12 +146,14 @@
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`;
}
}
}
}
</script>
<style>
page{background: #f5f5f5;}
page {
background: #f5f5f5;
}
</style>
<style lang="scss" scoped>
.content {
@ -133,25 +162,86 @@
align-items: center;
justify-content: center;
}
.memberBanner{
display:block;width:100%;
image{display:block;width:100%;}
.memberBanner {
display: block;
width: 100%;
image {
display: block;
width: 100%;
}
}
.buyBox{
width:690rpx;background:#fff;border-radius:20rpx;margin:30rpx auto;padding-bottom:20rpx;
.title{font-size:30rpx;color:#333;padding:30rpx;}
.formCol{
font-size:28rpx;color:#666;padding:0 30rpx;margin:20rpx auto;
.formRight{
margin:30rpx 0;
input{width:100%;height:80rpx;line-height: 80rpx;border:1rpx solid #dadada;border-radius: 8rpx;font-size:28rpx;color:#666;padding:0 20rpx;box-sizing: border-box;}
.uni-input{width:100%;height:80rpx;line-height: 80rpx;border:1rpx solid #dadada;border-radius: 8rpx;font-size:28rpx;color:#666;padding:0 20rpx;box-sizing: border-box;}
.buyBox {
width: 690rpx;
background: #fff;
border-radius: 20rpx;
margin: 30rpx auto;
padding-bottom: 20rpx;
.title {
font-size: 30rpx;
color: #333;
padding: 30rpx;
}
.formCol {
font-size: 28rpx;
color: #666;
padding: 0 30rpx;
margin: 20rpx auto;
.formRight {
margin: 30rpx 0;
input {
width: 100%;
height: 80rpx;
line-height: 80rpx;
border: 1rpx solid #dadada;
border-radius: 8rpx;
font-size: 28rpx;
color: #666;
padding: 0 20rpx;
box-sizing: border-box;
}
.uni-input {
width: 100%;
height: 80rpx;
line-height: 80rpx;
border: 1rpx solid #dadada;
border-radius: 8rpx;
font-size: 28rpx;
color: #666;
padding: 0 20rpx;
box-sizing: border-box;
}
}
}
}
.checkGroup{
display:flex;justify-content:flex-start;margin:20rpx 0;
label{width:50%;}
.checkGroup {
display: flex;
justify-content: flex-start;
margin: 20rpx 0;
label {
width: 50%;
}
}
.payBtn{width:690rpx;height:100rpx;color:#fff;font-size:30rpx;text-align: center;line-height: 100rpx;text-align: center;background: #FF578A;margin:0 auto;border-radius: 20rpx;}
</style>
.payBtn {
width: 690rpx;
height: 100rpx;
color: #fff;
font-size: 30rpx;
text-align: center;
line-height: 100rpx;
text-align: center;
background: #FF578A;
margin: 0 auto;
border-radius: 20rpx;
}
</style>

@ -21,7 +21,7 @@
methods: {
goMyOrder(){
uni.navigateTo({
url:"../../../packageOrder/pages/myOrder/myOrder"
url:"../../../packageOrder/pages/myOrder/myOrder?status=ongoing"
})
}
}

@ -1,109 +1,187 @@
<template>
<view class="content">
<view class="end-title" style="display:none;">
<view v-for="(item,index) in items" :key="index" :class="{btna:count == index}" @tap="change(index)">
{{item}}<view class="line"></view>
<view v-for="(item,index) in items" :key="index" :class="{btna:count == index}" @tap="change(index)">
{{item}}
<view class="line"></view>
</view>
</view>
<view class="end-cont" :class="{dis:btnnum == 0}">
<view class="statusBox">
<text v-for="(item,index) in statusLabels" :key="index" @click="changeStatus(index)" :class="{cur: index == status}">{{item}}</text>
<text v-for="(item,index) in statusLabels" :key="index" @click="changeStatus(item.state)"
:class="{cur: item.state == status}">{{item.txt}}</text>
</view>
<view style="height:120rpx;"></view>
  <view class="orderCol" v-for="(item, index) in list" :key="item.id" @click="goDetail(item.id)">
<view class="title">
<view>{{item.order_name || '暂无'}}<!-- <text class="free">免费</text> --></view>
<!-- <view class="status">待参加</view> -->
</view>
<view class="infoList">
<view class="infoCol"><view class="date"><image mode="heightFix" src="../../static/icon_shijian@2x.png"></image>{{item.created_at}}</view><view class="price"><text>¥</text>{{item.total}}</view></view>
<!--<view class="infoCol"><view class="address"><image mode="heightFix" src="../../static/icon_dizhi.png"></image>苏州·园区星海街188号苏州万怡大酒店南栋大酒店南栋</view></view>-->
<view v-if="list.length>0">
  <view class="orderCol" v-for="(item, index) in list" :key="item.id" @click="goDetail(item.id)">
<view class="title">
<view>{{item.order_name || '暂无'}}<!-- <text class="free">免费</text> -->
</view>
<view class="status">{{item.statusName}}</view>
</view>
<view class="infoList">
<view class="infoCol">
<view class="date">
<image mode="heightFix" src="../../static/icon_shijian@2x.png"></image>
{{item.created_at}}
</view>
<view class="price"><text>¥</text>{{item.total}}</view>
</view>
<!--<view class="infoCol"><view class="address"><image mode="heightFix" src="../../static/icon_dizhi.png"></image>苏州·园区星海街188号苏州万怡大酒店南栋大酒店南栋</view></view>-->
</view>
<view class="btn">
<!--<text> 预约服务 </text>-->
</view>
</view>
<view class="btn"><!--<text> 预约服务 </text>--></view>
</view>
</view>
<view v-else>
<view class="info-none"> {{list.length>0?"":"暂无数据"}} </view>
</view>
</view>
<view class="end-cont" :class="{dis:btnnum == 1}" >
<view class="end-cont" :class="{dis:btnnum == 1}">
<view class="statusBox">
<text>待付款</text>
<text class="cur">待服务</text>
<text>已服务</text>
<text>待评价</text>
</view>
  <view class="orderCol">
</view>
  <view class="orderCol">
<view class="title">
<view>33孕期保健Q&A<text class="free">免费</text></view>
<view class="status">待参加</view>
</view>
<view class="infoList">
<view class="infoCol"><view class="date"><image mode="heightFix" src="../../static/icon_shijian@2x.png"></image>2021-02-10 14:00</view><view class="price"><text>¥</text>100</view></view>
<view class="infoCol"><view class="address"><image mode="heightFix" src="../../static/icon_dianpu@2x.png"></image>苏州·园区星海街188号苏州万怡大酒店</view></view>
<view class="infoCol">
<view class="date">
<image mode="heightFix" src="../../static/icon_shijian@2x.png"></image>2021-02-10 14:00
</view>
<view class="price"><text>¥</text>100</view>
</view>
<view class="infoCol">
<view class="address">
<image mode="heightFix" src="../../static/icon_dianpu@2x.png"></image>苏州·园区星海街188号苏州万怡大酒店
</view>
</view>
</view>
<view class="btn"><text>投诉</text></view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
weixin
} from '../../../../utils/weixin.js';
//{"0":"","10":"","20":"","100":""}
export default {
data() {
return {
info: {
token: ''
},
},
btnnum: 0,
items:["活动订单","商品订单"],
count:"",
items: ["活动订单", "商品订单"],
count: "",
token: '',
page: 1,
list: [],
status: 0,
statusLabels: {0: "待确认", 10:"待支付", 20:"进行中", 100:"已完成"},
status: "",
statusLabels: [{
state: "",
txt: "全部"
}, {
state: "unpaid",
txt: "待支付"
}, {
state: "ongoing",
txt: "进行中"
}, {
state: "finished",
txt: "已完成"
}]
}
},
onLoad(options) {
const phone_token = uni.getStorageSync('phone_token')
this.info.phone = phone_token.phone
this.token = phone_token.token
this.status = options.status || 0
this.getOrderList()
this.token = phone_token.token;
if (!weixin.isNull(options.status))
this.status = options.status
},
onShow() {
this.list = []
this.getOrderList(1)
},
onShow() {
},
onReachBottom() {
this.getOrderList()
this.getOrderList(this.page + 1)
},
methods: {
changeStatus(i) {
this.status = i
this.page = 1
changeStatus(status) {
this.status = status
this.list = []
this.getOrderList()
this.getOrderList(1)
},
change(e) {
this.count = e
this.btnnum = e
console.log(this.count)
this.count = e
this.btnnum = e
console.log(this.count)
},
goDetail() {
uni.navigateTo({
url: "../orderPackageDetail/orderPackageDetail"
})
},
getOrderList() {
getOrderList(page) {
const phone_token = uni.getStorageSync('phone_token')
uni.showLoading({title: '加载中',mask:true});
uni.showLoading({
title: '加载中',
mask: true
});
var data = {
page: page,
page_size: 6,
token: phone_token.token
}
if (this.status != "") {
data = {
...data,
state: this.status
};
}
var that = this;
uni.request({
url: this.baseUrl + '/api/member/get-orders',
method: 'GET',
data: {
state: this.status,
page: this.page,
token: phone_token.token
},
data: data,
success: r => {
setTimeout(function () {uni.hideLoading();}, 100);
this.list = this.list.concat(r.data.data)
this.page++
setTimeout(function() {
uni.hideLoading();
}, 100);
var hasNoMore = that.list.length < 5 && page > 1;
if (hasNoMore || r.data.data.length == 0 && page > 1) {
//
uni.showToast({
title: '已加载到最后一页',
icon: 'none'
});
return;
}
for (var m of r.data.data) {
var mod = this.statusLabels.filter((p) => {
return p.state == m.state;
})[0];
if (mod)
m.statusName = mod.txt;
}
this.list = this.list.concat(r.data.data);
this.page = page;
}
})
}
}
}
}
</script>
@ -115,114 +193,208 @@
align-items: center;
justify-content: center;
}
.end-title{
display: flex;
width:100%;
.info-none {
padding: 40rpx;
color: #6E6E6E;
}
.end-title {
display: flex;
width: 100%;
height: 88rpx;
background: #FFFFFF;
box-shadow: 0px 2px 12px 0px #DEE4E7;
line-height: 88rpx;
font-size: 32rpx;
font-weight: 400;
color:#333;
color: #333;
position: fixed;
top:0;
left:0;
z-index: 999;
}
.end-title view{
flex-grow: 1;
text-align: center;
top: 0;
left: 0;
z-index: 999;
}
.end-title view {
flex-grow: 1;
text-align: center;
position: relative;
.line{position: absolute;width: 128rpx;height: 8rpx;background: #FF578A;border-radius: 4rpx;bottom:0;left:50%;margin-left:-64rpx;display: none;}
}
.end-cont{
display: none;
.line {
position: absolute;
width: 128rpx;
height: 8rpx;
background: #FF578A;
border-radius: 4rpx;
bottom: 0;
left: 50%;
margin-left: -64rpx;
display: none;
}
}
.end-cont {
display: none;
// padding-top:88rpx;
}
.btna{
color: #FF578A;
}
.btna .line{display:block!important;}
.dis{
display: block;
}
.orderCol{
}
.btna {
color: #FF578A;
}
.btna .line {
display: block !important;
}
.dis {
display: block;
}
.orderCol {
background: #fff;
border-radius: 16rpx;
width:710rpx;
margin:20rpx auto 0 auto;
width: 710rpx;
margin: 20rpx auto 0 auto;
padding: 0 30rpx;
box-sizing: border-box;
.title{
padding:30rpx 0;
.title {
padding: 30rpx 0;
display: flex;
justify-content: space-between;
align-content: center;
align-items: center;
font-size:32rpx;
font-size: 32rpx;
font-weight: 500;
color:#333;
.free{display:inline-block;width: 58rpx;height: 32rpx;background: #FF753E;border-radius: 6rpx;font-size: 20rpx;font-weight: 400;color: #FFFFFF;text-align: center;line-height:32rpx;margin-left:10rpx;}
.status{font-size: 28rpx;font-weight: 400;color: #666666;}
color: #333;
.free {
display: inline-block;
width: 58rpx;
height: 32rpx;
background: #FF753E;
border-radius: 6rpx;
font-size: 20rpx;
font-weight: 400;
color: #FFFFFF;
text-align: center;
line-height: 32rpx;
margin-left: 10rpx;
}
.status {
font-size: 28rpx;
font-weight: 400;
color: #666666;
}
}
.btn{
.btn {
display: flex;
justify-content: flex-end;
padding:30rpx 0;
text{
padding: 30rpx 0;
text {
display: block;
width: 160rpx;
height: 64rpx;
border-radius: 8rpx;
border: 2rpx solid #DEDEDE;
border: 2rpx solid #DEDEDE;
font-size: 28rpx;
font-weight: 400;
color: #333333;
text-align:center;
line-height:64rpx;
color: #333333;
text-align: center;
line-height: 64rpx;
}
}
.infoList{
.infoCol{
.infoList {
.infoCol {
display: flex;
justify-content: space-between;
color:#666;
color: #666;
font-size: 28rpx;
line-height:1.8;
line-height: 1.8;
align-items: center;
align-content: center;
.date image{width:26rpx;height:26rpx;display: inline-block;margin-right:12rpx;}
.bulid{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
.bulid image{width:25rpx;height:26rpx;display: inline-block;margin-right:12rpx;}
.address{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
.address image{width:24rpx;height:26rpx;display: inline-block;margin-right:12rpx;}
.price{
.date image {
width: 26rpx;
height: 26rpx;
display: inline-block;
margin-right: 12rpx;
}
.bulid {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.bulid image {
width: 25rpx;
height: 26rpx;
display: inline-block;
margin-right: 12rpx;
}
.address {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.address image {
width: 24rpx;
height: 26rpx;
display: inline-block;
margin-right: 12rpx;
}
.price {
font-size: 36rpx;
font-weight: 500;
color: #FF578A;
text{font-size: 28rpx;margin-right:5rpx;}
color: #FF578A;
text {
font-size: 28rpx;
margin-right: 5rpx;
}
}
}
}
}
.statusBox{
width:750rpx;
margin:2rpx auto;
.statusBox {
width: 750rpx;
margin: 2rpx auto;
box-sizing: border-box;
height:120rpx;
height: 120rpx;
background: #fff;
display: flex;
padding:0 30rpx;
padding: 0 30rpx;
justify-content: space-around;
align-items: center;
align-content: center;
color:#666;
font-size:28rpx;
color: #666;
font-size: 28rpx;
position: fixed;
left:0;
top:-1rpx;
text{display:block;width: 156rpx;height: 64rpx;background: #F0F0F0;border-radius: 32rpx;text-align: center;line-height:64rpx;}
.cur{background: #FF578A;color:#fff;}
left: 0;
top: -1rpx;
text {
display: block;
width: 156rpx;
height: 64rpx;
background: #F0F0F0;
border-radius: 32rpx;
text-align: center;
line-height: 64rpx;
}
.cur {
background: #FF578A;
color: #fff;
}
}
</style>
</style>

@ -0,0 +1,201 @@
<template>
<view class="content">
<view class="orderBox">
<view class="title">时光印记孕妈妈摄影套餐</view>
</view>
<view class="orderBox">
<view class="title">订单信息</view>
<view class="hasTwo">
<view class="p_left"><text class="twoWords"></text>:</view>
<view class="p_right">王大宝</view>
</view>
<view class="hasTwo">
<view class="p_left"><text class="halfWords"></text><text class="halfWords"></text>:</view>
<view class="p_right">13844345606</view>
</view>
<view class="hasTwo">
<view class="p_left">预产期/宝宝生日:</view>
<view class="p_right">2020-12-11</view>
</view>
<view class="hasTwo">
<view class="p_left"><text class="twoWords"></text>:</view>
<view class="p_right">¥100</view>
</view>
<view class="hasTwo">
<view class="p_left">实付金额:</view>
<view class="p_right">¥100</view>
</view>
<view class="hasTwo">
<view class="p_left"><text class="twoWords"></text>:</view>
<view class="p_right"><text class="font_red">已使用</text></view>
</view>
</view>
</view>
</template>
<script>
import {
weixin
} from '../../../../utils/weixin.js';
export default {
data() {
return {}
},
onLoad() {
},
methods: {
}
}
</script>
<style lang="scss" scoped>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-top: 20rpx;
}
.orderBox {
width: 710rpx;
margin: 0 auto 20rpx auto;
padding: 30rpx;
box-sizing: border-box;
background: #fff;
border-radius: 16rpx;
position: relative;
.serviceBtn {
width: 160rpx;
height: 56rpx;
background: #FF578A;
border-radius: 28rpx;
color: #fff;
font-size: 28rpx;
font-weight: 500;
text-align: center;
line-height: 56rpx;
position: absolute;
right: 30rpx;
top: 30rpx;
}
.serviceBtn.disabled {
background: #CCCCCC;
}
.subBtn {
width: 160rpx;
height: 56rpx;
background: #FF578A;
border-radius: 28rpx;
color: #fff;
font-size: 28rpx;
font-weight: 500;
text-align: center;
line-height: 56rpx;
margin: 40rpx auto 0 auto;
}
.seeMap {
position: absolute;
right: 30rpx;
top: 116rpx;
font-size: 28rpx;
font-weight: 400;
.iconfont {
color: #BBBBBB;
margin-left: 10rpx;
}
}
.ticketNum {
font-size: 32rpx;
font-weight: 500;
color: #333333;
margin-top: 24rpx;
text-align: center;
}
.qr_box {
width: 300rpx;
height: 300rpx;
margin: 45rpx auto 0 auto;
image {}
}
.title {
font-size: 32rpx;
font-weight: 500;
color: #333333;
}
.p {
font-size: 28rpx;
font-weight: 400;
color: #999999;
margin-top: 5rpx;
}
.hasTwo {
display: flex;
justify-content: flex-start;
font-size: 28rpx;
color: #333;
margin-top: 30rpx;
.p_left {
margin-right: 30rpx;
color: #999;
min-width: 120rpx;
}
}
.discuss {
display: flex;
justify-content: flex-start;
margin-top: 32rpx;
.dis_l {
font-size: 28rpx;
color: #999;
padding-top: 10rpx;
}
.starBox {
display: flex;
justify-content: flex-start;
margin-left: 32rpx;
image {
display: block;
width: 48rpx;
height: 48rpx;
margin-right: 32rpx;
}
}
.areaOuter {
box-sizing: border-box;
border-radius: 7rpx;
border: 1rpx solid #DEDEDE;
width: 530rpx;
margin-left: 32rpx;
textarea {
height: 150rpx;
font-size: 28rpx;
padding: 20rpx;
box-sizing: border-box;
width: 100%;
box-sizing: border-box;
}
}
}
}
</style>

@ -134,6 +134,13 @@
"navigationBarBackgroundColor": "#fff"
}
},
{
"path": "pages/orderPackageDetail/orderPackageDetail",
"style": {
"navigationBarTitleText": "订单详情",
"navigationBarBackgroundColor": "#fff"
}
},
{
"path": "pages/myOrder/myOrder",

@ -21,7 +21,8 @@
<image class="i_close" @click="close" src="../../static/details_close@2x.png"></image>
<view class="title">购会员享特权</view>
<view class="cardOuter">
<view v-for="(i, k) in packages" :class="{cur: cardActive == k, cardCol: true}" @click="cardActive = k">
<view v-for="(i, k) in packages" :class="{cur: cardActive == k, cardCol: true}"
@click="cardActive = k">
<view>{{i.name}}</view>
<view class="cardTit">{{i.price}}</view>
</view>
@ -36,8 +37,8 @@
<uni-popup ref="shareCode" :mask-click="true" type="bottom" class="shareBox">
<view class="codeOuter">
<view class="shareCon" @click="shareClose">
<canvas style="width:100%;" :style="{ height: (cropperH-50) + 'px' }" canvas-id="firstCanvas"
id="firstCanvas"></canvas>
<canvas style="width:80%;margin-left:10%;position: absolute;"
:style="{ height:(shareHeight*scare) + 'px', marginTop:(cropperH-(shareHeight*scare))/2+'rpx'}" canvas-id="firstCanvas" id="firstCanvas"></canvas>
<!-- <image class="shareBg" mode="widthFix" src="../../static/bg_haibao@2x.png"></image> -->
<!-- <image class="code" src="../../static/300_qr.png"></image> -->
</view>
@ -55,7 +56,10 @@
<script>
let sysInfo = uni.getSystemInfoSync();
let SCREEN_WIDTH = sysInfo.screenWidth
let SCREEN_HEIGHT = sysInfo.screenHeight
let SCREEN_HEIGHT = sysInfo.screenHeight;
let WindowHeight=sysInfo.windowHeight;
let windowWidth=sysInfo.windowWidth;
import {
weixin
} from '../../utils/weixin.js';
@ -72,12 +76,20 @@
cropperW: SCREEN_WIDTH,
cropperH: SCREEN_HEIGHT,
packages: [],
sharePath: "",
scare:1,
shareHeight:500
}
},
onLoad() {
onLoad(option) {
if (option.promotion_id) {
uni.setStorageSync("base_promotion_id", option.promotion_id)
}
weixin.getOpenidInfo(info => {
this.user_info = info
})
}, false)
this.scare=windowWidth/375;
},
onShow() {
if (this.checkLogin()) {
@ -96,69 +108,105 @@
uni.showLoading({
title: '加载中'
});
var that = this;
this.$refs.shareCode.open()
uni.request({
url: this.baseUrl + '/api/member/get-wxa-qrcode',
method: 'GET',
data: {
path: '',
scene: this.user_info.id
path: 'pages/member/member',
scene: 'promotion_id=' + this.user_info.id
},
success: r => {
if (r.data.status === 1) {
uni.getImageInfo({
src: this.baseUrl + r.data.data, //
success: res => {
let ctx = uni.createCanvasContext('firstCanvas')
var ctx = uni.createCanvasContext('firstCanvas')
var w = SCREEN_WIDTH * 0.8;
var h = this.shareHeight*this.scare;
// ctx.fillStyle = '#fff';
// ctx.fillRect(0, 0, 214, 342);
ctx.drawImage('../../static/bg_haibao@2x.jpg', SCREEN_WIDTH *
0.1, (SCREEN_HEIGHT - 50 - SCREEN_WIDTH * 0.8 * 1.65) /
2, SCREEN_WIDTH * 0.8, SCREEN_WIDTH * 0.8 * 1.5);
ctx.drawImage('../../static/bg_haibao1.png',
SCREEN_WIDTH *
0.15, (SCREEN_HEIGHT - SCREEN_WIDTH * 0.6 * 1.65) /
2, SCREEN_WIDTH * 0.695, SCREEN_WIDTH * 0.6 * 1.5);
ctx.drawImage('../../static/member_01.jpg',
SCREEN_WIDTH * 0.15, (SCREEN_HEIGHT - SCREEN_WIDTH * 0.6 * 1.65) /
2, SCREEN_WIDTH * 0.695, SCREEN_WIDTH * 0.695/ 1.6);
ctx.font = "22px bold";
ctx.drawImage('../../static/bg_haibao@2x.jpg', 0, 0,
w, h
); //(SCREEN_HEIGHT - 50 - SCREEN_WIDTH * 0.8 * 1.65) /2, SCREEN_WIDTH * 0.8, SCREEN_WIDTH * 0.8 * 1.5);
ctx.drawImage('../../static/bg_haibao1.png', 20, 30 + 40, w -
40, h - 100);
/* SCREEN_WIDTH *
0.15, (SCREEN_HEIGHT - SCREEN_WIDTH * 0.6 * 1.65) /
2, SCREEN_WIDTH * 0.695, SCREEN_WIDTH * 0.6 * 1.5); */
ctx.drawImage('../../static/member_01.jpg', 20, 30 + 40, w -
40, (h - 60 - 60) * 0.5);
/* SCREEN_WIDTH * 0.15, (SCREEN_HEIGHT - SCREEN_WIDTH *
0.6 * 1.65) /
2, SCREEN_WIDTH * 0.695, SCREEN_WIDTH * 0.695 / 1.6); */
ctx.font = "22rpx bold";
//
ctx.fillStyle = "#fff";
// xy
ctx.fillText("会员福利孕产礼包", SCREEN_WIDTH * 0.15, (SCREEN_HEIGHT-SCREEN_WIDTH * 0.8 * 1.5)/2);
ctx.font = "16px bold";
ctx.fillText("会员福利孕产礼包", 20, 50);
ctx.font = "16rpx bold";
//
ctx.fillStyle = "#000";
// xy
ctx.fillText("专享大礼包", SCREEN_WIDTH * 0.2, (SCREEN_HEIGHT-SCREEN_WIDTH * 0.8 * 1.5)/2+SCREEN_WIDTH * 0.695/ 1.6*1.5);
// ctx.beginPath();
// ctx.arc(SCREEN_WIDTH * 0.62+SCREEN_WIDTH * 0.2*0.5, (SCREEN_HEIGHT -
// 50 - SCREEN_WIDTH * 0.8 * 1.5) / 2 + SCREEN_WIDTH *
// 0.8 * 1.02+SCREEN_WIDTH * 0.2*0.5, SCREEN_WIDTH * 0.2, 2 * Math.PI);
// ctx.clip();
this.circleImg(ctx,res.path, SCREEN_WIDTH * 0.62, (SCREEN_HEIGHT -
50 - SCREEN_WIDTH * 0.8 * 1.5) / 2 + SCREEN_WIDTH *
0.8 * 1.05, SCREEN_WIDTH * 0.2/2);
ctx.draw(),
// r:
setTimeout(() => {
uni.canvasToTempFilePath({
canvasId: 'firstCanvas',
fileType: 'jpg',
success: (res) => {
this.shareBtnDisplay = 'flex'
uni.hideLoading()
this.img = res.tempFilePath
},
})
}, 100)
ctx.fillText("专享大礼包", 40, (h + 50) * 0.5 + 20);
ctx.font = "14rpx bold";
//
ctx.fillStyle = "#3377b7";
// xy
ctx.fillText("¥19.9元起福利卡", 40, (h + 50) * 0.5 + 20 + 30);
let user_info = uni.getStorageSync("user_info_yunyubang");
let userProfile = uni.getStorageSync('user_profile');
var img = '../../static/avatar.jpg';
uni.getImageInfo({
src: userProfile.avatarUrl, //
success: rlogo => {
img = rlogo.path;
}
});
that.circleImg(ctx,
img,
40, h - 60 - w * 0.15,
w * 0.15 / 2);
ctx.font = "12rpx normal";
//
ctx.fillStyle = "#000";
// xy
ctx.fillText(user_info.name + "/" + user_info.phone,
40, h - 40);
this.circleImg(ctx, res.path, w - 40 - w * 0.2, h - 40 - w *
0.2, w * 0.2 / 2);
ctx.draw(),
// r:
setTimeout(() => {
uni.canvasToTempFilePath({
canvasId: 'firstCanvas',
fileType: 'jpg',
success: (res) => {
this.shareBtnDisplay = 'flex'
uni.hideLoading();
this.img =
'../../static/member_01.jpg'
this.sharePath = res
.tempFilePath;
},
})
}, 100)
}
})
} else {
@ -169,22 +217,24 @@
}
})
},
circleImg: function (ctx, img, x, y, r){
circleImg: function(ctx, img, x, y, r) {
ctx.save()
var d = 2 * r;
var cx = x + r;
var cy = y + r;
ctx.arc(cx, cy, r, 0, 2 * Math.PI);
ctx.setStrokeStyle('#FFFFFF')
ctx.stroke()
ctx.clip();
ctx.drawImage(img, x, y, d, d);
ctx.restore()
},
ctx.restore();
},
shareClose() {
this.$refs.shareCode.close()
},
open() {
this.$refs.popup.open('top')
},
close() {
this.$refs.popup.close()
@ -193,14 +243,13 @@
if (this.checkLogin()) {
this.$refs.popup.close()
let package_id = this.packages.length > 0 ? this.packages[this.cardActive].id : 0
if( this.packages.length == 0){
if (this.packages.length == 0) {
uni.showToast({
title: '请选择套餐',
icon:'none',
duration: 1000
});
}
else{
title: '请选择套餐',
icon: 'none',
duration: 1000
});
} else {
uni.navigateTo({
url: "../../packages/packageBuy/pages/buyMember/buyMember?package_id=" + package_id
});
@ -209,15 +258,17 @@
},
//h5
save() {
console.log(1)
let _this = this;
// #ifdef H5
uni.previewImage({
urls: [_this.img]
urls: [_this.sharePath]
})
// #endif
// #ifdef APP-PLUS||MP-WEIXIN
uni.saveImageToPhotosAlbum({
filePath: _this.img,
filePath: _this.sharePath,
success: function() {
_this.$refs.shareCode.close()
_this.alert('保存成功')
@ -230,16 +281,16 @@
// this.packages = r
// }, 'GET')
const phone_token = uni.getStorageSync('phone_token')
uni.request({
url: this.baseUrl + '/api/member/get-packages',
weixin.request({
api: '/api/member/get-packages',
method: 'GET',
data: {
token: phone_token.token
utilSuccess: r => {
this.packages = r.data
},
success: r => {
this.packages = this.packages.concat(r.data.data)
utilFail: r => {
console.log(r);
}
})
})
},
}
}
@ -336,12 +387,13 @@
.cardOuter {
display: flex;
justify-content:flex-start;
justify-content: flex-start;
padding: 20rpx;
.cardCol {
width: 224rpx;
height: 156rpx;
margin:0 15rpx;
margin: 0 15rpx;
border-radius: 8rpx;
box-sizing: border-box;
border: 2rpx solid #F5DFB5;

@ -2,37 +2,38 @@
<view class="main">
<image mode="widthFix" src="../../static/bg_my@2x.png"></image>
<view class="topImg-btn-bg" :style="{top:titleHeight.statusBarHeight + 8 + 'px'}">
<view class="title-h" >我的</view>
</view>
<view class="title-h">我的</view>
</view>
<view class="top_view" v-if="showTiele">
<view class="state-h" :style="{ height: titleHeight.statusBarHeight + 8 + 'px'}"></view>
<view class="topImg-btn-bg" :style="{top:titleHeight.statusBarHeight + 'px'}">
<view class="title-h" >我的</view>
<view class="title-h">我的</view>
</view>
</view>
<view class="myMain">
<view class="myInfo">
<image mode="scaleToFill" :src="userProfile.avatarUrl ? userProfile.avatarUrl : '../../static/banner@3x.jpg'"></image>
<image mode="scaleToFill"
:src="userProfile.avatarUrl ? userProfile.avatarUrl : '../../static/banner@3x.jpg'"></image>
<view class="title">{{userProfile.nickName || '匿名用户'}}</view>
</view>
<view class="myOrder">
<view class="orderTab">我的订单</view>
<view class="orderTab">我的订单</view>
<view class="content">
<view class="tabCol">
<view class="orderMenu">
<view class="menuCol" @tap="goOrderCol(0)">
<!-- <view class="menuCol" @tap="goOrderCol(0)">
<image src="../../static/icon_daifukuan@2x.png"></image>
<text>待确认</text>
</view>
<view class="menuCol" @tap="goOrderCol(10)">
</view> -->
<view class="menuCol" @tap="goOrderCol('unpaid')">
<image src="../../static/icon_daifuwu@2x.png"></image>
<text>待支付</text>
</view>
<view class="menuCol" @tap="goOrderCol(20)">
<view class="menuCol" @tap="goOrderCol('ongoing')">
<image src="../../static/icon_yifuwu@2x.png"></image>
<text>进行中</text>
</view>
<view class="menuCol" @tap="goOrderCol(100)">
<view class="menuCol" @tap="goOrderCol('finished')">
<image src="../../static/icon_daipingjia@2x.png"></image>
<text>已完成</text>
</view>
@ -40,67 +41,63 @@
<image src="../../static/icon_dingdan@2x.png"></image>
<text>全部订单</text>
<image class="line" src="../../static/bg_yinying@2x.png"></image>
</view>
</view>
</view>
</view>
</view>
</view>
<!--更多服务-->
<view class="introBox">
<view class="introBox" style="display: none;">
<view class="normal_tit">更多服务</view>
<view class="serviceBox">
<view class="serviceCol" @tap="nodata()">
<image src="../../static/icon_shoucang_1@2x.png"></image>
<text>我的收藏</text>
<text>我的收藏</text>
</view>
<view class="serviceCol" @tap="nodata()">
<image src="../../static/icon_pingjia@2x.png"></image>
<text>评价中心</text>
<text>评价中心</text>
</view>
<view class="serviceCol" @tap="nodata()">
<image src="../../static/icon_tousu@2x.png"></image>
<text>用户投诉</text>
<text>用户投诉</text>
</view>
<view class="serviceCol" @tap="nodata()">
<image src="../../static/icon_tuikuan@2x.png"></image>
<text>我的退款</text>
<text>我的退款</text>
</view>
<view class="serviceCol" @tap="nodata()">
<image src="../../static/icon_fenxiang@2x.png"></image>
<text>分享</text>
<text>分享</text>
</view>
<view class="serviceCol" @tap="nodata()">
<image src="../../static/icon_youhuiquan@2x.png"></image>
<text>优惠券</text>
</view>
<text>优惠券</text>
</view>
</view>
</view>
</view>
<!--推广业绩-->
<view class="introBox">
<view class="normal_tit">推广业绩</view>
<view class="serviceBox">
<view class="serviceCol" @tap="nodata()">
<image src="../../static/icon_daifukuan@2x.png"></image>
<text>我的订单</text>
</view>
<view class="serviceCol" @tap="nodata()">
<text>我的订单</text>
</view>
<view class="serviceCol" @tap="goTuiguang()" v-if="user_info.promotion!=1">
<image src="../../static/icon_shenqingzhuce@2x.png"></image>
<text>申请注册</text>
</view>
<text>申请注册</text>
</view>
</view>
</view>
<!--推广工具-->
<view class="introBox">
<view class="introBox" v-if="user_info.promotion==1">
<view class="normal_tit">推广工具</view>
<view class="serviceBox">
<view class="serviceCol" @tap="nodata()">
<image src="../../static/icon_poster@2x.png"></image>
<text>专属海报</text>
<text>专属海报</text>
</view>
<view class="serviceCol" @tap="goTuiguang()">
<image src="../../static/icon_shangpin@2x.png"></image>
<text>推广申请</text>
</view>
</view>
</view>
<!--为您精选-->
@ -126,27 +123,36 @@
<view class="price"><text class="font_red">免费</text></view>
</view>
</view>
</view> -->
</view> -->
</view>
</view>
</template>
<script>
import {
weixin
} from '../../utils/weixin.js';
export default {
data() {
return {
titleHeight:[],
showTiele:false,
items:[
{title:"活动订单"},
{title:"商品订单"}
titleHeight: [],
showTiele: false,
items: [{
title: "活动订单"
},
{
title: "商品订单"
}
],
current:0,
current: 0,
userProfile: {},
user_info: {}
}
},
onLoad() {
this.stytemInfo();
this.user_info = uni.getStorageSync("user_info_yunyubang")
},
onShow() {
if (this.checkLogin()) {
@ -154,62 +160,63 @@
if (userProfile) {
this.userProfile = userProfile
} else {
uni.navigateTo({ url: '../login/index?showProfile=1'})
}
uni.navigateTo({
url: '../login/index?showProfile=1'
})
}
}
},
onPageScroll(e) {
var that = this;
if(e.scrollTop > 60 ){
that.showTiele = true;
}else{
that.showTiele = false;
}
},
var that = this;
if (e.scrollTop > 60) {
that.showTiele = true;
} else {
that.showTiele = false;
}
},
methods: {
//
stytemInfo:function(){
stytemInfo: function() {
var that = this;
uni.getSystemInfo({
success: function (res) {
success: function(res) {
that.titleHeight = res;
console.log(that.titleHeight)
}
}
})
},
goTuiguang(){
goTuiguang() {
uni.navigateTo({
url:"../../packages/packagePromotion/pages/speadApply/speadApply"
url: "../../packages/packagePromotion/pages/applyReg/applyReg"
})
},
toMyOrder(){
toMyOrder() {
uni.navigateTo({
url:"../../packages/packageOrder/pages/myOrder/myOrder"
url: "../../packages/packageOrder/pages/myOrder/myOrder"
})
},
goOrderCol(v){
goOrderCol(v) {
uni.navigateTo({
url:"../../packages/packageOrder/pages/myOrder/myOrder?status=" + v
url: "../../packages/packageOrder/pages/myOrder/myOrder?status=" + v
})
},
nodata(){
},
nodata() {
uni.showToast({
title: '正在建设中',
duration: 1000
});
title: '正在建设中',
duration: 1000
});
},
onClickItem(e){
if(this.current !== e.currentIndex)
{
this.current = e.currentIndex
onClickItem(e) {
if (this.current !== e.currentIndex) {
this.current = e.currentIndex
}
},
open(){
open() {
this.$refs.calendar.open()
},
confirm(e) {
console.log(e);
}
}
}
}
</script>
@ -219,151 +226,256 @@
}
</style>
<style lang="scss">
.main {
display: flex;
flex-direction: column;
}
.topImg-btn-bg{
color:#fff;
font-weight: 400;
width:100%;
left:0;
font-size:34rpx;
position: fixed;
display: flex;
justify-content: center;
align-items: center;
z-index: 4;
text-align: center;
}
.top_view{
background-color: #FF578A;
display: flex;
width: 100%;
align-items: center;
position: fixed;
left:0;
z-index:9;
top:0;
.state-h{width:100%;background-color:#FF578A;}
.topImg-btn-bg{background-color: #FF578A;width:100%;height:88rpx;}
}
.myMain{width:100%;margin-top:-240rpx;}
.myInfo{
width:100%;display: flex;justify-content: flex-start;align-items: center;align-content: center;padding: 0 36rpx;box-sizing: border-box;
image{width:112rpx;height:112rpx;border-radius: 50%;margin-right:30rpx;}
.title{font-size: 36rpx;font-weight: 500;color: #FFFFFF;line-height: 36px;}
}
.myOrder{width:710rpx;background:rgba(255,255,255,1);border-radius: 16rpx;margin:30rpx auto 0 auto;}
.orderTab{
font-size: 34rpx;font-weight: 400;width:60%;margin-left:10rpx;padding:30rpx 30rpx 0 30rpx;
}
.segmented-control__item--text{border-color: rgba(255,255,255,0)!important;}
.segmented-control__text{color:#666666;}
.tabCol{width:100%;}
.orderMenu{
display: flex;justify-content: flex-start;align-items: center;align-content: center;width:100%;
background: #fff;border-radius: 16rpx;
.menuCol{
width:20%;
font-size: 24rpx;
.main {
display: flex;
flex-direction: column;
}
.topImg-btn-bg {
color: #fff;
font-weight: 400;
color: #333333;
padding:35rpx 0;
width: 100%;
left: 0;
font-size: 34rpx;
position: fixed;
display: flex;
justify-content: center;
align-items: center;
z-index: 4;
text-align: center;
image{display: block;width:48rpx;height:48rpx;margin:0 auto;}
text{display: block;margin-top:18rpx;}
}
.allOrder{
position: relative;
text{color:#FF753E;}
.line{display: block;position: absolute;width:26rpx;height:96rpx;top:50%;margin-top:-48rpx;left:-10%;}
.top_view {
background-color: #FF578A;
display: flex;
width: 100%;
align-items: center;
position: fixed;
left: 0;
z-index: 9;
top: 0;
.state-h {
width: 100%;
background-color: #FF578A;
}
.topImg-btn-bg {
background-color: #FF578A;
width: 100%;
height: 88rpx;
}
}
}
.serviceBox{
display: flex;
flex-wrap: wrap;
.serviceCol{
width:25%;
font-size: 24rpx;
font-weight: 400;
color: #333333;
text-align:center;
padding:8rpx 0 34rpx 0;
.myMain {
width: 100%;
margin-top: -240rpx;
}
.myInfo {
width: 100%;
display: flex;
justify-content: flex-start;
align-items: center;
align-content: center;
padding: 0 36rpx;
box-sizing: border-box;
image{display: block;width:48rpx;height:48rpx;margin:0 auto;}
text{display: block;margin-top:18rpx;}
image {
width: 112rpx;
height: 112rpx;
border-radius: 50%;
margin-right: 30rpx;
}
.title {
font-size: 36rpx;
font-weight: 500;
color: #FFFFFF;
line-height: 36px;
}
}
.myOrder {
width: 710rpx;
background: rgba(255, 255, 255, 1);
border-radius: 16rpx;
margin: 30rpx auto 0 auto;
}
.orderTab {
font-size: 34rpx;
font-weight: 400;
width: 60%;
margin-left: 10rpx;
padding: 30rpx 30rpx 0 30rpx;
}
.segmented-control__item--text {
border-color: rgba(255, 255, 255, 0) !important;
}
}
.introBox{
width:710rpx;
margin:20rpx auto 0 auto;
.segmented-control__text {
color: #666666;
}
.tabCol {
width: 100%;
}
.orderMenu {
display: flex;
justify-content: space-around;
align-items: center;
align-content: center;
width: 100%;
background: #fff;
border-radius: 16rpx;
.menuCol {
width: 20%;
font-size: 24rpx;
font-weight: 400;
color: #333333;
padding: 35rpx 0;
text-align: center;
image {
display: block;
width: 48rpx;
height: 48rpx;
margin: 0 auto;
}
text {
display: block;
margin-top: 18rpx;
}
}
.allOrder {
position: relative;
text {
color: #FF753E;
}
.line {
display: block;
position: absolute;
width: 26rpx;
height: 96rpx;
top: 50%;
margin-top: -48rpx;
left: -10%;
}
}
}
.serviceBox {
display: flex;
flex-wrap: wrap;
.serviceCol {
width: 25%;
font-size: 24rpx;
font-weight: 400;
color: #333333;
text-align: center;
padding: 8rpx 0 34rpx 0;
box-sizing: border-box;
image {
display: block;
width: 48rpx;
height: 48rpx;
margin: 0 auto;
}
text {
display: block;
margin-top: 18rpx;
}
}
}
.introBox {
width: 710rpx;
margin: 20rpx auto 0 auto;
border-radius: 16rpx;
background: #fff;
padding:0 35rpx;
padding: 0 35rpx;
box-sizing: border-box;
}
.intro_row{
.intro_row {
display: flex;
justify-content: space-between;
width:100%;
width: 100%;
}
.row_col{
width:310rpx;
.row_col {
width: 310rpx;
border-radius: 8rpx;
padding-bottom:20rpx;
.imgOuter{
width:310rpx;
height:230rpx;
padding-bottom: 20rpx;
.imgOuter {
width: 310rpx;
height: 230rpx;
position: relative;
image{
width:310rpx;
height:230rpx;
border-radius:8rpx 8rpx 0 0;
}
.date{
background-color: rgba(0,0,0,0.3);
font-size:20rpx;
color:#fff;
line-height:32rrpx;
padding:0 8rpx;
image {
width: 310rpx;
height: 230rpx;
border-radius: 8rpx 8rpx 0 0;
}
.date {
background-color: rgba(0, 0, 0, 0.3);
font-size: 20rpx;
color: #fff;
line-height: 32rrpx;
padding: 0 8rpx;
border-radius: 5rpx;
position: absolute;
left: 20rpx;
bottom:20rpx;
font-weight:500;
bottom: 20rpx;
font-weight: 500;
}
}
.title{
width:100%;
font-size:28rpx;
color:#333;
font-weight:500;
.title {
width: 100%;
font-size: 28rpx;
color: #333;
font-weight: 500;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
padding-top:20rpx;
padding-top: 20rpx;
}
.subTit{
width:100%;
font-size:22rpx;
color:#333;
font-weight:400;
.subTit {
width: 100%;
font-size: 22rpx;
color: #333;
font-weight: 400;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
padding-top:10rpx;
}
.price{
margin-top:20rpx;
font-size:22rpx;
color:#999;
text{
font-size:32rpx;
font-weight:400;
padding-right:15rpx;
padding-top: 10rpx;
}
.price {
margin-top: 20rpx;
font-size: 22rpx;
color: #999;
text {
font-size: 32rpx;
font-weight: 400;
padding-right: 15rpx;
}
}
}
</style>
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

@ -1,51 +1,140 @@
import {appConfig} from '../config'
import {
appConfig
} from '../config'
const openid_info_key = appConfig.openidInfoKey
const user_info_key = 'user_info_yunyubang'
export const weixin = {
getOpenidInfo: (cb, refresh) => {
cb = cb || function () {}
refresh = refresh || false
if (!refresh) {
let user_info = uni.getStorageSync(user_info_key)
if (user_info && user_info.openid && user_info.session_key) {
cb(user_info)
return
request: options => {
if (!options.customLoading) {
uni.showLoading({
title: '正在加载'
});
} else {
// 当前页面请求数量+1
if (options.bindThis) {
options.bindThis.setData({
//loadingCount: options.bindThis.data.loadingCount + 1
});
}
}
}
uni.login({
provider: 'weixin',
success: (res) => {
uni.request({
url: appConfig.baseUrl + '/api/member/login-by-code',
method: 'POST',
data: {code: res.code},
success: result => {
const user_info1 = result.data.data.user_info
user_info1.openid = user_info1.wechat_openid
uni.setStorageSync(user_info_key, user_info1)
cb(user_info1)
}
});
}
});
},
getUserProfile: (cb) => {
cb = cb || function () {}
options.url = appConfig.baseUrl + options.api;
options.header = {
...options.header,
//'Accept': 'application/json',
//'Connection': 'keep-alive'
//'content-type': 'application/json'
}; // 如果已登录,请求中拼openId
wx.getUserProfile({
desc: '用于完善会员资料',
success: (res) => {
uni.setStorageSync('user_profile', res.userInfo)
cb(res.userInfo)
}
})
},
getUserInfoCache: () => {
return uni.getStorageSync(user_info_key)
}
var access_token = uni.getStorageSync("phone_token").token;
if (!weixin.isNull(access_token)) {
options.data = {
...options.data,
'token': access_token
};
} // 如果是POST方法
if (options.method == 'POST' && !weixin.isNull(access_token)) {
// 拼时间戳
options.data.ts = new Date().getTime();
}
uni.request({
...options,
success: function(res) {
if (res.statusCode != 200) {
if (options.utilFail != undefined) {
if (res.statusCode == 401) {
uni.clearStorageSync();
uni.navigateTo({
url: '/pages/login/index'
});
} else {
options.utilFail('TODO: 特殊处理非200错误(' + res.statusCode + ')');
}
}
} else {
if (!weixin.isNull(res.data.errorcode) || res.data.errorcode == 0) {
if (options.utilFail != undefined) {
options.utilFail(res.data.errormsg || '接口发生未知错误');
} else {
options.utilFail(res.data.errormsg);
}
} else {
if (options.utilSuccess != undefined) {
options.utilSuccess(res.data);
}
}
}
},
fail: options.utilFail,
complete: function(res) {
if (!options.customLoading) {
uni.hideNavigationBarLoading();
uni.hideLoading();
} else {
// 当前页面请求数量-1
if (options.bindThis) {
options.bindThis.setData({
loadingCount: options.bindThis.data.loadingCount - 1
});
}
}
}
});
},
getOpenidInfo: (cb, refresh) => {
cb = cb || function() {}
refresh = refresh || false
if (!refresh) {
let user_info = uni.getStorageSync(user_info_key)
if (user_info && user_info.openid && user_info.session_key) {
cb(user_info)
return
}
}
uni.login({
provider: 'weixin',
success: (res) => {
uni.request({
url: appConfig.baseUrl + '/api/member/login-by-code',
method: 'POST',
data: {
code: res.code
},
success: result => {
const user_info1 = result.data.data.user_info
user_info1.openid = user_info1.wechat_openid
uni.setStorageSync(user_info_key, user_info1)
cb(user_info1)
}
});
}
});
},
getUserProfile: (cb) => {
cb = cb || function() {}
wx.getUserProfile({
desc: '用于完善会员资料',
success: (res) => {
uni.setStorageSync('user_profile', res.userInfo)
cb(res.userInfo)
}
})
},
getUserInfoCache: () => {
return uni.getStorageSync(user_info_key)
},
isNull: p => {
return p == '' || p == undefined || p == null || p == 'undefined' || p == 'null';
} // 正则
}
export function login() {
@ -64,4 +153,4 @@ export function login() {
// })
// }
// });
}
}

Loading…
Cancel
Save