wong1988 1 year ago
parent
commit
5d725581f7
  1. 249
      pages/card/card_booking.vue
  2. 101
      pages/card/card_record.vue
  3. 138
      pages/card/card_record_detail.vue
  4. 139
      pages/me/base_info.vue

249
pages/card/card_booking.vue

@ -1,249 +0,0 @@
<template>
<!-- 不分页的时候用没有封装 auto 首次使用需要自己在onload里调用 -->
<!-- 页面的几种状态 0 loading 1 错误 2正常 -->
<loading-state ref="pageView" @request="request">
<view>
<image src="../../static/edit_bg.png" style="width: 100%;height: 40vw;z-index: 0;"></image>
<view style="display: flex;flex-direction: column;margin-top: -40vw;">
<view style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;">
<view style="flex: 1;display: flex;flex-direction: column;z-index: 1;margin-left: 15px;">
<view style="font-size: 17px;color: #FFFFFF;height: 8vw;line-height: 8vw;margin-top: 5vw;">
{{data.state}}
</view>
<view
style="font-size: 12px;color: white;line-height: 7vw;height: 7vw;color: #f1f2f3;box-sizing: border-box;">
{{data.name}}
</view>
<view style="font-size: 12px;color: white;line-height: 4vw;height: 4vw;color: #f1f2f3;">
{{data.time}}
</view>
</view>
<image src='../../static/gift2.png'
style="width: 40px;height: 40px;padding-right: 30px;flex-shrink: 0;">
</image>
</view>
<view
style="background: #FFFFFF;border-radius: 20rpx;z-index: 1;min-height: 14vw;margin-left: 15px;margin-right: 15px;margin-top: 4vw;">
<view style="display: flex;align-items: center;margin-top: 8px;">
<text style="flex-shrink: 0;font-size: 13px;margin-left: 10px;">提货地点</text>
<view
style="display: flex;flex-direction: row;justify-content: space-between;width: 100%;border: 1px solid #EBEEF5;border-radius: 4px;min-height: 35px;margin: 0px 10px;align-items: center;"
@click="address">
<view v-if="stringIsEmpty(data.addressName)"
style="color: #666;font-size: 12px;margin-left: 10px;">请选择提货点</view>
<view v-if="stringIsNotEmpty(data.addressName)"
style="color: #666;font-size: 12px;margin-left: 10px;">{{data.addressName}}</view>
<uni-icons type="bottom" size="14" color="#999"
style="flex-direction: 0;margin: 0px 5px;" />
</view>
</view>
<view
style="display: flex;align-items: center;padding-right: 10px;margin-top: 6px;margin-bottom: 8px;">
<text style="flex-shrink: 0;font-size: 13px;margin-left: 10px;margin-right: 10px;">提货时间</text>
<uni-datetime-picker type="date" v-model="data.reserveDate" style="flex: 1;" :start="data.start"
:end="data.end" @showing='showing' />
</view>
<view
style="display: flex;align-items: center;padding-right: 10px;margin-top: 6px;margin-bottom: 8px;">
<text style="flex-shrink: 0;font-size: 13px;margin-left: 10px;margin-right: 10px; "
decode="true">&ensp;&ensp;</text>
<input placeholder="请输入提货人"
style="font-size: 30rpx;flex: 1;background: #F8F8F8;border-radius: 5px;height: 40px;line-height: 40px;padding-left: 10px;"
:value="data.userName" @input="onKeyInput1" />
</view>
<view
style="display: flex;align-items: center;padding-right: 10px;margin-top: 6px;margin-bottom: 8px;">
<text style="flex-shrink: 0;font-size: 13px;margin-left: 10px;margin-right: 10px;">联系电话</text>
<input maxlength="11" placeholder="请输入联系电话"
style="font-size: 30rpx;flex: 1;background: #F8F8F8;border-radius: 5px;height: 40px;line-height: 40px;padding-left: 10px;"
type="number" :value="data.userPhone" @input="onKeyInput2" />
</view>
</view>
<view style="background: #FFFFFF;border-radius: 20rpx;padding: 15px;margin: 10px 15px;">
<view
style="display: flex;flex-direction: row;align-items: center;border-bottom: 1rpx #f1f2f3 solid;padding-bottom: 10px;">
<image src="../../static/mingxi.png" style="width: 15px;height: 15px;"></image>
<view style="margin-left: 10px;font-size: 14px;">商品明细</view>
</view>
<view v-for="(item,index) in data.goodsVos" @click="itemClick(item.goodsSid)"
style="display: flex;flex-direction: row;margin-top: 15px;">
<image :src="item.pic" style="width: 60px;height: 60px;flex-shrink: 0;"></image>
<view
style="margin-left: 10px;margin-right: 10px;flex: 1;display: flex;flex-direction: column;justify-content: space-between;align-items: flex-end;">
<text class="text" style="font-weight: 500;width: 100%;">{{item.goods}}
</text>
<text class="text"
style="width: 100%;font-size: 12px; color: #666666;margin-top: 10px;">{{item.remarks}}
</text>
<uni-number-box ref="box" style="margin-top: -25px;" :min="0" :max="item.lnum"
v-model="item.select" :showTextView="page.showTextView"></uni-number-box>
</view>
</view>
</view>
</view>
<view style="height: 60px;"></view>
<view v-if="data.showBtn||data.showRecord"
style="position: fixed;bottom: 0;height: 50px;background: #f3f4f6;border-top: 1rpx #cacaca solid;width: 100%;display: flex;flex-direction: row;box-sizing: border-box;align-items: center;padding-right: 15px;">
<view style="flex: 1;"></view>
<view v-if="data.showRecord" class="btn" style="flex-shrink: 0;color: #191919;" @click="save">
提交预约</view>
</view>
</view>
</loading-state>
</template>
<script>
//bus
import bus from '@/common/bus';
export default {
data() {
return {
page: {
sid: '',
showTextView: false
},
data: {
time: "",
name: "",
pname: "",
state: "",
showBtn: false,
showRecord: false,
goodsVos: [],
value: "",
select: [],
userName: "",
userPhone: "",
}
}
},
onLoad(options) {
this.page.sid = options.sid
this.request()
uni.$on("address", (e) => {
//
this.data.value = e.sid;
this.data.addressName = e.name;
})
},
onUnload() {
uni.$off('address');
},
methods: {
address() {
uni.navigateTo({
url: '/pages/SelectAddressActivity'
})
},
onKeyInput1: function(event) {
this.data.userName = event.target.value
},
onKeyInput2: function(event) {
this.data.userPhone = event.target.value
},
showing(e) {
this.page.showTextView = e
},
request() {
let _this = this
_this.$api.cardBooking(this.page.sid).then((resp) => {
_this.data = resp
// 2
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(2)
})
}).catch(e => {
// 1
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
},
save() {
if (this.stringIsEmpty(this.data.value)) {
this.shortToast('请选择提货地点')
return
}
if (this.stringIsEmpty(this.data.reserveDate)) {
this.shortToast('请选择提货时间')
return
}
if (this.stringIsEmpty(this.data.userName)) {
this.shortToast('请输入提货人员')
return
}
if (this.stringIsEmpty(this.data.userPhone)) {
this.shortToast('请输入手机号码')
return
}
if (this.data.userPhone.length != 11) {
this.shortToast('手机号码格式不对')
return
}
let num = 0;
for (var i = 0; i < this.data.goodsVos.length; i++) {
num += Number(this.data.goodsVos[i].select);
}
if (num == 0) {
this.shortToast('您未选择任何商品')
return
}
let _this = this
_this.$api.cardBookingSave(this.data).then((resp) => {
bus.$emit('order', "监听回调");
uni.navigateBack()
}).catch(e => {
_this.shortToast('发生异常')
})
},
itemClick(goodsSid) {
uni.navigateTo({
url: '/pages/good/goodsDetail?sid=' + goodsSid
})
}
}
}
</script>
<style>
.text {
white-space: normal;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
uni-page-body,
page {
background: #F1F2F3;
}
.btn {
border: 1px solid;
padding-left: 30rpx;
padding-right: 30rpx;
padding-top: 12rpx;
padding-bottom: 12rpx;
border-radius: 50rpx;
height: 15px;
margin-left: 25rpx;
font-size: 26rpx;
}
</style>

101
pages/card/card_record.vue

@ -1,101 +0,0 @@
<template>
<loading-state ref="pageView" @request="request">
<view v-for="(item,index) in data" style="display: flex;flex-direction: column;margin-top: 15px; margin-left: 15px; margin-right: 15px;">
<view
style="display: flex;flex-direction: column;border: 1px solid #e29a68;width: 100%;border-radius: 20rpx;margin-top: 8px;"
@click="detail(item.orderSid)">
<view class="use">
<image style="width: 70rpx;height: 70rpx;position: absolute;right: 40px;"
src="../../static/card_line.png"></image>
<image src="../../static/gift.png" style="width: 30px;height: 30px;padding-left: 6px;"></image>
<view style="flex: 1;display: flex;flex-direction: column;z-index: 1;">
<view style="font-size: 14px;padding: 2px;padding-left: 5px;padding-top: 7px;">{{item.code}}
</view>
</view>
<view
style="flex-shrink: 0;padding: 9px;font-size: 13px;z-index: 1;font-weight: 600;">{{item.reserveDate}}
</view>
</view>
<view
style="display: flex;flex-direction: column; padding: 10px;border-bottom-left-radius: 20rpx;border-bottom-right-radius: 20rpx;background-color: #fdf0ee;">
<view style="width: 100%;display: flex;flex-direction: row;align-items: center;">
<text>礼包类型</text>
<text>{{item.bagName}}</text>
</view>
<view style="width: 100%;display: flex;flex-direction: row;align-items: center;margin-top: 5px;">
<text>提货门店</text>
<text>{{item.store}}</text>
</view>
</view>
</view>
</view>
</loading-state>
</template>
<script>
export default {
data() {
return {
page: {
sid: '',
},
data: [
]
}
},
onLoad(options) {
this.page.sid = options.sid
this.request()
},
methods: {
request() {
let _this = this
_this.$api.orderByCardSid(this.page.sid).then((resp) => {
_this.data = resp
// 2
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(2)
})
//
if(_this.data.length==0){
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(100)
})
}
}).catch(e => {
// 1
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
},
detail(sid) {
uni.navigateTo({
url: '/pages/card/card_record_detail?sid=' + sid
})
},
}
}
</script>
<style>
.use {
display: flex;
flex-direction: row;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
color: #FFF;
align-items: center;
background: linear-gradient(89.8deg, rgba(218, 51, 33, 1) -3.76%, rgba(237, 113, 53, 0) 300.05%);
}
</style>

138
pages/card/card_record_detail.vue

@ -1,138 +0,0 @@
<template>
<loading-state ref="pageView" @request="request">
<view>
<image src="../../static/edit_bg.png" style="width: 100%;height: 40vw;z-index: 0;"></image>
<view style="display: flex;flex-direction: column;margin-top: -40vw;">
<view style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;">
<view style="flex: 1;display: flex;flex-direction: column;z-index: 1;margin-left: 15px;">
<view style="font-size: 17px;color: #FFFFFF;height: 8vw;line-height: 8vw;margin-top: 5vw;">
{{data.state}}
</view>
<view
style="font-size: 12px;color: white;line-height: 7vw;height: 7vw;color: #f1f2f3;box-sizing: border-box;">
{{data.name}}
</view>
<view style="font-size: 12px;color: white;line-height: 4vw;height: 4vw;color: #f1f2f3;">
{{data.time}}
</view>
</view>
<image src='../../static/gift2.png'
style="width: 40px;height: 40px;padding-right: 30px;flex-shrink: 0;">
</image>
</view>
<view
style="background: #FFFFFF;border-radius: 20rpx;z-index: 1;height: 20vw;margin-left: 15px;margin-right: 15px;margin-top: 4vw;display: flex;
flex-direction: column; ">
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 5px;">
<image src="../../static/pName.png" style="width: 15px;height: 15px;margin-left: 15px;"></image>
<view style="margin-left: 15px;font-size: 14px;">{{data.pname}}</view>
</view>
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 5px;">
<image src="../../static/pName.png" style="width: 15px;height: 15px;margin-left: 15px;"></image>
<view style="margin-left: 15px;font-size: 14px;">{{data.reserveDate}}</view>
</view>
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 5px;">
<image src="../../static/pName.png" style="width: 15px;height: 15px;margin-left: 15px;"></image>
<view style="margin-left: 15px;font-size: 14px;">{{data.store}}</view>
</view>
</view>
<view style="background: #FFFFFF;border-radius: 20rpx;padding: 15px;margin: 10px 15px;">
<view
style="display: flex;flex-direction: row;align-items: center;border-bottom: 1rpx #f1f2f3 solid;padding-bottom: 10px;">
<image src="../../static/mingxi.png" style="width: 15px;height: 15px;"></image>
<view style="margin-left: 10px;font-size: 14px;">商品明细</view>
</view>
<view v-for="(item,index) in data.goodsVos"
style="display: flex;flex-direction: row;margin-top: 15px;">
<image :src="item.pic" style="width: 60px;height: 60px;flex-shrink: 0;"></image>
<view style="margin-left: 10px;margin-right: 10px;flex: 1;">
<text class="text" style="font-weight: 500;">{{item.goods}}
</text>
<view style="font-size: 12px;color: #666666;">提货数量{{item.orderNum}}</view>
</view>
</view>
</view>
</view>
<view style="height: 60px;"></view>
</view>
</loading-state>
</template>
<script>
export default {
data() {
return {
page: {
sid: ''
},
data: {
time: "",
name: "",
pname: "",
state: "",
showBtn: false,
showRecord: false,
goodsVos: []
}
}
},
onLoad(options) {
this.page.sid = options.sid
this.request()
},
methods: {
request() {
let _this = this
_this.$api.orderDetails(this.page.sid).then((resp) => {
_this.data = resp
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(2)
})
}).catch(e => {
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
},
}
}
</script>
<style>
.text {
white-space: normal;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
uni-page-body,
page {
background: #F1F2F3;
}
.btn {
border: 1px solid;
padding-left: 30rpx;
padding-right: 30rpx;
padding-top: 12rpx;
padding-bottom: 12rpx;
border-radius: 50rpx;
height: 15px;
margin-left: 25rpx;
font-size: 26rpx;
}
</style>

139
pages/me/base_info.vue

@ -0,0 +1,139 @@
<template>
<view style="display: flex;flex-direction: column;">
<NavBar ref="nav" navTitle="个人信息" :showIcon="true">
</NavBar>
<loading-state ref="pageView" @request="request">
<view @click="uploadHeadImage()" class="menu-item">
<text class="text">头像</text>
<image :src="page.photo" style="width: 70rpx;height: 70rpx;margin-right: 10rpx;"></image>
<image class="more" src="../../static/more.png"></image>
</view>
<view class="line-thin"></view>
<view @click="remark()" class="menu-item">
<text class="text">昵称</text>
<text class="explain">{{page.nick}}</text>
<image class="more" src="../../static/more.png"></image>
</view>
</loading-state>
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" title="修改昵称" :value="page.nick" placeholder="请输入内容"
@confirm="dialogInputConfirm"></uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
page: {}
}
},
onLoad(options) {
this.request()
},
methods: {
//
request() {
let _this = this
_this.$api.getBaseInfo(getApp().globalData.sid).then((resp) => {
_this.page = resp
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(2)
})
}).catch(e => {
console.log(e);
})
},
uploadHeadImage() {
let _this = this
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
uni.uploadFile({
url: _this.$api.headerUpload,
filePath: tempFilePaths[0],
name: 'file',
formData: {
'userSid': getApp().globalData.sid
},
success: (uploadFileRes) => {
_this.page.photo = JSON.parse(uploadFileRes.data).data;
}
});
}
});
},
//
remark() {
this.$refs.inputDialog.open()
},
dialogInputConfirm(val) {
let _this = this
_this.$api.changeNick({
userSid: getApp().globalData.sid,
userNickName: val
}).then((resp) => {
_this.page.nick = val
}).catch(e => {
console.log(e);
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #f1f2f3;
}
.menu-item {
height: 112rpx;
width: auto;
display: flex;
flex-direction: row;
background-color: #fff;
align-items: center;
padding-left: 36rpx;
padding-right: 36rpx;
}
.more {
width: 35rpx;
height: 35rpx;
float: right;
}
.menu-item .icon {
width: 69rpx;
height: 35rpx;
}
.menu-item .text {
font-size: 32rpx;
color: #101010;
flex: 1;
float: left;
}
.menu-item .explain {
font-size: 28rpx;
color: #828282;
margin-right: 10rpx;
}
.line-thin {
height: 1rpx;
width: 100%;
background-color: #eee;
}
</style>
Loading…
Cancel
Save