You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

485 lines
14 KiB

<template>
<view
style="display: flex;flex-direction: column; height: 100vh;background: -webkit-linear-gradient(left,#FEA65F,#FB9440); box-sizing: border-box;"
id="page">
<view class="top">
<NavBar ref="nav" navTitle=" " :showIcon="false" :start-change-height="page.startHeight"
:end-change-height="page.endHeight">
</NavBar>
<view style="display: flex;flex-direction: row;align-items: center;
margin-top: 25vw; margin-left: 8vw;">
<image style="width: 70px;height: 70px;border-radius: 50%;" :src="userInfo.photo" @click="showDiaLog">
</image>
<view style="display: flex;flex-direction: column;margin-left: 10px;" v-if="userInfo.nick!=''">
<text style="font-size: 16px;color: #fff;" @click="showDiaLog">{{userInfo.nick}}</text>
<text style="font-size: 14px;color: #fff;">{{userInfo.mobile}}</text>
</view>
<view style="display: flex;flex-direction: column;margin-left: 10px;" v-if="userInfo.nick==''">
<text style="font-size: 16px;color: #fff;" @click="showDiaLog">绑定用户</text>
</view>
</view>
</view>
<view
style="background: #fff;flex-flow: 1; height: calc(100vh - 50vw - 48px); width: 100%; margin-top: -18vw;border-top-left-radius: 25px;border-top-right-radius: 25px;border-bottom-left-radius: 25px;border-bottom-right-radius: 25px;">
<scroll-view scroll-y="true"
style=" height: 100%; width: 100%; padding-top: 10px;
border-top-left-radius: 25px;border-top-right-radius: 25px;border-bottom-left-radius: 25px;border-bottom-right-radius: 25px;"
bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
<view style=" display: flex;flex-direction: column;
padding-top: 5vw;padding-left: 5vw;padding-right: 5vw;">
<view style="display: flex;flex-direction: row;align-items: center;">
<view
style="display: flex;flex-direction: column; flex: 1;justify-content: center;align-items: center;">
<image src="https://supervise.yxtsoft.com/lpk/image/reservation_icon.png"
style="width: 30px;height: 30px;"></image>
<text style="margin-top: 5px;">预约记录</text>
</view>
<view
style="display: flex;flex-direction: column; flex: 1;justify-content: center; align-items: center;">
<image src="https://supervise.yxtsoft.com/lpk/image/order_icon.png"
style="width: 30px;height: 30px;"></image>
<text style="margin-top: 5px;">订单</text>
</view>
<view
style="display: flex;flex-direction: column; flex: 1;justify-content: center;align-items: center; ">
<image src="https://supervise.yxtsoft.com/lpk/image/forward_icon.png"
style="width: 30px;height: 30px;"></image>
<text style="margin-top: 5px;">转赠记录</text>
</view>
<view
style="display: flex;flex-direction: column; flex: 1;justify-content: center;align-items: center; ">
</view>
</view>
</view>
<!-- <loading-state ref="pageView" @request="request"> -->
<view v-if="banKInfo!=null" style="display: flex;flex-direction: column; margin-top: 15px;
border-top: 2px #f3f3f3 solid;padding-top: 15px; margin-left: 4vw;margin-right: 4vw;">
<view style="display: flex;flex-direction: row;align-items: center;" >
<text style="flex: 1;">{{banKInfo.storeName}}</text>
<text style="margin-left: 10px;margin-right: 5px;">变更</text>
<image src="../../static/right_icon.png" style="width: 15px;height: 15px;"></image>
</view>
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 15px;">
<image src="https://supervise.yxtsoft.com/lpk/image/date.png"
style="width: 20px;height: 20px;"></image>
<text style="margin-left: 5px;flex: 1;color: #ECAF4A;">营业时间:{{banKInfo.businessHours}}</text>
</view>
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 10px;">
<image src="https://supervise.yxtsoft.com/lpk/image/location.png"
style="width: 20px;height: 20px;"></image>
<text style="margin-left: 5px;flex: 1; color: #ECAF4A;">{{banKInfo.address}}</text>
</view>
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 15px;">
<text style="flex: 1;">提菜人</text>
<text style="margin-left: 10px;margin-right: 5px;">{{banKInfo.name}}</text>
<image src="../../static/right_icon.png" style="width: 15px;height: 15px;"></image>
</view>
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 10px;">
<text style="flex: 1;">联系信息</text>
<text style="margin-left: 10px;margin-right: 5px;">{{banKInfo.phone}}</text>
<image src="../../static/right_icon.png" style="width: 15px;height: 15px;"></image>
</view>
</view>
<view style="display: flex;flex-direction: column;margin-top: 15px;margin-left: 4vw;margin-right: 4vw;
border-top: 2px #f3f3f3 solid;padding-top: 15px;">
<view style="display: flex;flex-direction: row;align-items: center;">
<view style="display: flex;flex-direction: row;align-items: center; flex: 1;">
<view style="background: #FF9D33; border-radius: 50%;width: 12px;height: 12px;"></view>
<view style="background: #FFDAB2; border-radius: 50%;width: 12px;height: 12px;"></view>
<text style="margin-left: 8px;font-size: 18px;color: #333;font-weight: 600;font-family: sans-serif;">推荐有礼</text>
</view>
<view style="display: flex;flex-direction: row;align-items: center;">
<text style="margin-left: 10px;margin-right: 5px;">马上推荐</text>
<image src="../../static/right_icon.png" style="width: 15px;height: 15px;"></image>
</view>
</view>
<text style="font-size: 12px;color: #4B4B4B; margin-top: 8px;">邀请新朋友后,您和您的朋友将获得“蔬菜品鉴礼包”。</text>
<view style="display: flex;flex-direction: row;align-items: center; ">
<image :src="recommend.iconUrl" style="width: 35%;height: 150px; border-radius: 10px;" mode="aspectFill">
</image>
<view style="display: flex;flex-direction: column; margin-left: 20px; ">
<view v-for="(child,pos) in recommend.recordList" :key="pos"
style="display: flex;flex-direction: column;">
<text style="color: #424242; font-size: 12px;line-height: 20px;">* {{child.content}}</text>
</view>
</view>
</view>
</view>
<view style="height: 150px;"></view>
<!-- </loading-state> -->
</scroll-view>
</view>
<!-- 弹窗蒙版 -->
<view class="model" catchtouchmove='preventTouchMove' v-if='showModal' @click.stop="colseDialog()"></view>
<view class="modalDlg" catchtouchmove='preventTouchMove' v-if='showModal'>
<view style="display:flex;flex-direction: column;justify-content: center;align-items: center;
margin-top: 20px;">
<image src="../../static/logo_icon.png" style="width: 20vw;height: 20vw;"></image>
<text style="margin-top: 10px;">汇融云菜窖</text>
<text style="margin-top: 10px;">邀请补全您的个人信息</text>
<text style="margin-top: 10px;">(头像、昵称)</text>
<view style="display: flex;flex-direction: column;
margin-top: 20px;">
<view
style="display: flex;flex-direction: row; justify-content: space-between;align-items: center;">
<text>头像</text>
<image :src="dialogInfo.url"
style="width: 40px; height: 40px; border-radius: 50%;background-color: #ccc;"></image>
</view>
<view
style="display: flex;flex-direction: row; justify-content: space-between;align-items: center;">
<text>昵称</text>
<input placeholder="请输入昵称"
style="font-size: 30rpx;height: 40px;line-height: 40px;padding-left: 10px;padding-right: 10px;"
:value="dialogInfo.name" @input="onKeyInput1" />
</view>
<view
style="display: flex;flex-direction: row; justify-content: space-between;align-items: center;">
<text>手机号码</text>
<input placeholder="请输入手机号码" type="number" maxlength="11"
style="font-size: 30rpx;height: 40px;line-height: 40px;padding-left: 10px;padding-right: 10px;"
:value="dialogInfo.mobile" @input="onKeyInput2" />
</view>
</view>
</view>
<view style="display: flex;flex-direction: row;margin-top: 20px;">
<button style="flex: 1;" class='btn1' @click="colseDialog()">取消</button>
<button style="flex: 1;" class='btn2' open-type="chooseAvatar" @chooseavatar="onChooseAvatar"
v-if="chooseAvatar">上传头像</button>
<button style="flex: 1;" class='btn2' @click="saveDialog()" v-if="!chooseAvatar">确定</button>
</view>
</view>
<!-- 弹窗蒙版 -->
<view class="model" catchtouchmove='preventTouchMove' v-if='showModal2' @click.stop="colseDialog2()"></view>
<view class="modalDlg" catchtouchmove='preventTouchMove' v-if='showModal2'>
<view style="display:flex;flex-direction: column;justify-content: center;align-items: center;
margin-top: 20px;">
<image src="../../static/logo.png" style="width: 20vw;height: 20vw;"></image>
<text style="margin-top: 10px;">汇融云菜窖</text>
<text style="margin-top: 10px;">申请获取您的手机号码</text>
</view>
<view style="display: flex;flex-direction: row;margin-top: 20px;">
<button style="flex: 1;" class='btn1' @click="colseDialog()">拒绝</button>
<button style="flex: 1;" class='btn2' open-type="getPhoneNumber">允许</button>
</view>
</view>
</view>
</template>
<script>
//引入bus
import bus from '@/common/bus';
import config from '@/common/config.js'
export default {
data() {
return {
uploadAction: config.baseUrl + "/lpkcustomer/uploadfile",
showModal: false,
showModal2: false,
chooseAvatar: true,
page: {
startHeight: 0,
endHeight: 0
},
data: {},
userInfo: {
nick: "",
mobile: "绑定手机号",
photo: "../../static/userHead.png"
},
dialogInfo: {
url: "../../static/userHead.png",
name: "",
mobile: ""
},
headImage: "",
recommend:{},
banKInfo:null
}
},
onShow() {
if (typeof this.$mp.page.getTabBar === 'function' && this.$mp.page.getTabBar()) {
this.$mp.page.getTabBar().setData({
selected: 2
})
}
this.getUserInfo()
this.getStoreBySid()
this.myRecommend()
},
onLoad(options) {
// this.request()
let info = uni.getSystemInfoSync();
this.page.startHeight = info.windowWidth * 0.6
this.page.endHeight = info.windowWidth * 0.8
},
onPageScroll(res) {
// 渐变
this.$refs.nav.defaultColorBgAlpha(res)
},
methods: {
getUserInfo() {
let _this = this
_this.$api.getUserInfo(getApp().globalData.sid).then((resp) => {
_this.userInfo = {
nick: resp.nick,
mobile: resp.mobile,
photo: resp.photo
}
_this.headImage = resp.data.photo
}).catch(e => {
})
},
getStoreBySid(){
let _this = this
_this.$api.getStoreBySid(getApp().globalData.sid).then((resp) => {
_this.banKInfo = resp
}).catch(e => {
})
},
myRecommend(){
let _this = this
_this.$api.myRecommend(getApp().globalData.sid).then((resp) => {
_this.recommend = resp
}).catch(e => {
})
},
showDiaLog() {
this.showModal = true
},
colseDialog() {
this.showModal = false
},
saveDialog() {
let _this = this
if (this.stringIsEmpty(this.dialogInfo.name)) {
this.shortToast('请输入昵称')
return
}
if (this.dialogInfo.mobile.length != 11) {
this.shortToast('手机号码格式不对')
return
}
var params = {
sid: getApp().globalData.sid,
photo: _this.headImage,
nick: _this.dialogInfo.name,
mobile: _this.dialogInfo.mobile
}
_this.$api.uploadHandImage(params).then((resp) => {
// if (resp.success) {
_this.chooseAvatar = true
_this.colseDialog()
_this.userInfo = {
nick: _this.dialogInfo.name,
mobile: _this.dialogInfo.mobile,
photo: _this.headImage
}
}).catch(e => {
console.log('eeeee', e)
})
},
showDiaLog2() {
this.showModal2 = true
},
colseDialog2() {
this.showModal2 = false
},
onKeyInput1(event) {
this.dialogInfo.name = event.target.value
},
onKeyInput2(event) {
this.dialogInfo.mobile = event.target.value
},
onChooseAvatar(e) {
this.dialogInfo.url = e.detail.avatarUrl;
this.uploadImage(e.detail.avatarUrl)
},
uploadImage(imagePath) {
let _this = this
wx.uploadFile({
url: _this.uploadAction, // 上传图片的接口地址
fileType: "image",
filePath: imagePath, // 图片文件路径
name: 'file', // 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
success: (res) => {
// 上传成功后,将服务器返回的图片地址更新到image标签中
let info = JSON.parse(res.data)
_this.headImage = info.data.fullUrl
_this.chooseAvatar = false
},
fail: function(res) {
console.log(res);
}
})
},
}
}
</script>
<style>
.btn1 {
font-size: 18px;
color: #949094;
background: #fff;
height: 13vw;
line-height: 13vw;
text-align: center;
border-bottom-left-radius: 20px;
}
.btn1::after {
/* border: none; */
}
.btn2 {
font-size: 18px;
color: #FB913C;
background: #fff;
height: 13vw;
line-height: 13vw;
text-align: center;
border-bottom-right-radius: 20px;
}
.btn2::after {
/* border: none; */
}
.top {
width: 100vw;
/* height: 126.66vw; */
height: 65vw;
/* 加载背景图 */
background-image: url(https://supervise.yxtsoft.com/lpk/image/my_bj.png);
/* 让背景图基于容器大小伸缩 */
background-size: 100% 100%;
}
/* 弹窗样式 */
.model {
position: absolute;
width: 100%;
height: 100%;
background: #000;
z-index: 999;
opacity: 0.5;
top: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
}
.modalDlg {
/* 设置超出滚动 */
position: absolute;
top: 50vw;
left: 10vw;
width: 80%;
z-index: 9999;
background-color: #fff;
border-radius: 20px;
display: flex;
flex-direction: column;
}
</style>