2023-11-28

This commit is contained in:
2023-11-28 11:38:33 +08:00
parent e7cf9e1d57
commit 83f1e822c1
22 changed files with 2772 additions and 12 deletions

View File

@@ -44,10 +44,10 @@
this.page.customerSid = getApp().globalData.sid
},
methods: {
onKeyInput1: function(event) {
onKeyInput1(event) {
this.page.code = event.target.value
},
onKeyInput2: function(event) {
onKeyInput2(event) {
this.page.codeKey = event.target.value
},
scan() {
@@ -55,8 +55,8 @@
let _this = this
uni.scanCode({
onlyFromCamera: true,
success: function(res) {
_this.page.cardNum = res.result.substring(res.result.length - 20, res.result.length)
success(res) {
_this.page.code = res.result.substring(res.result.length - 20, res.result.length)
}
});
},
@@ -65,6 +65,7 @@
this.shortToast('请输入或扫描20位提货编码')
return
}
if (this.stringIsEmpty(this.page.codeKey) || this.page.codeKey.length != 6) {
this.shortToast('请输入6位提货密码')
return
@@ -74,7 +75,7 @@
uni.navigateBack()
uni.$emit('order', {})
}).catch(e => {
_this.shortToast('发生异常')
_this.longToast(e.msg)
})
}
}

150
pages/card/card_bind2.vue Normal file
View File

@@ -0,0 +1,150 @@
<template>
<!-- 扫码进入 携带参数 -->
<view style="box-sizing: border-box;">
<image src="../../static/bing_bg.png" style="width: 100vw;height: 50vw;z-index: 0;"></image>
<view style="display: flex;flex-direction: column;margin-top: -10vw;box-sizing: border-box;">
<view
style="display: flex;flex-direction: column;border-radius: 20rpx;background: #FFFFFF;z-index: 1;align-items: center;box-sizing: border-box;">
<view style="margin: 15px;">绑定礼包卡</view>
<view
style="display: flex;flex-direction: row;justify-content: space-between;box-sizing: border-box;width: calc(100vw - 60px);align-items: center;">
<input maxlength="20" placeholder="请输入/扫码 提货编码"
style="font-size: 30rpx;flex: 1;background: #F8F8F8;border-radius: 5px;height: 40px;line-height: 40px;margin-right: 10px;padding-left: 10px;"
type="number" :value="page.code" @input="onKeyInput1" />
<uni-icons type="camera-filled" color="#c0c4cc" size="22" style="flex-shrink: 0;" @click="scan" />
</view>
<view
style="display: flex;flex-direction: row;justify-content: space-between;box-sizing: border-box;width: calc(100vw - 60px);align-items: center;margin-top: 10px;">
<input maxlength="6" placeholder="请输入提货密码"
style="font-size: 30rpx;flex: 1;background: #F8F8F8;border-radius: 5px;height: 40px;line-height: 40px;padding-left: 10px;"
type="number" :value="page.codeKey" @input="onKeyInput2" />
</view>
</view>
</view>
<view
style="margin: 30px;background-color: #fd3655;width: calc(100% - 60px);border-radius: 100rpx;height: 80rpx;display: flex;flex-direction: column;align-items: center;line-height: 80rpx;color: #FFFFFF;font-size: 36rpx;"
@click="save">
绑定</view>
</view>
</template>
<script>
export default {
data() {
return {
page: {
code: '',
codeKey: '',
customerSid: ''
}
}
},
onLoad(options) {
let _this = this;
wx.login({
success: function(res) {
uni.request({
// 组装请求地址
url: getApp().globalData.wxSilentLoginURL + "?wxCode=" + res.code,
method: "GET",
header: {
'content-type': "application/x-www-form-urlencoded"
},
data: {
"wxCode": res.code
},
success: res => {
if (res.statusCode == 200) {
if (!res.data.success) {
if (res.data.code == "110") {
// 需要绑定手机号
uni.reLaunch({
url: '/pages/index/BindPhone?openid=' +
res.data.data.wxMpOpenid
})
} else {
// _this.status = 'more'
}
} else {
// 成功后跳转主页
getApp().globalData.sid = res.data.data.sid
_this.page.customerSid = getApp().globalData.sid
console.log("用户sid", getApp().globalData.sid)
}
} else {
// _this.status = 'more'
}
},
fail: (err) => {
// _this.status = 'more'
}
});
},
fail: function(res) {
// _this.status = 'more'
}
});
if (options) {
console.log("options", options)
const q = decodeURIComponent(options.q) // 获取到二维码原始链接内容
console.log("二维码原始链接内容", q)
var code = q.split('=')[1]
// var code = this.getQueryString(q, 'code');// code是你二维码链接里面的参数名
console.log("提货卡编码", code)
this.page.code = code
}
},
methods: {
onKeyInput1: function(event) {
this.page.code = event.target.value
},
onKeyInput2: function(event) {
this.page.codeKey = event.target.value
},
scan() {
// 只允许通过相机扫码
let _this = this
uni.scanCode({
onlyFromCamera: true,
success: function(res) {
_this.page.code = res.result.substring(res.result.length - 20, res.result.length)
}
});
},
save() {
if (this.stringIsEmpty(this.page.code) || this.page.code.length != 20) {
this.shortToast('请输入或扫描20位提货编码')
return
}
if (this.stringIsEmpty(this.page.codeKey) || this.page.codeKey.length != 6) {
this.shortToast('请输入6位提货密码')
return
}
let _this = this
_this.$api.cardBind(this.page).then((resp) => {
uni.switchTab({
url: '/pages/card/card'
})
uni.$emit('order', {})
}).catch(e => {
_this.longToast(e.msg)
})
}
}
}
</script>
<style>
</style>

View File

@@ -38,6 +38,20 @@
<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;">提货人员</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>
@@ -91,7 +105,9 @@
showRecord: false,
goodsVos: [],
value: "",
select: []
select: [],
userName:"",
userPhone:"",
}
}
},
@@ -100,6 +116,12 @@
this.request()
},
methods: {
onKeyInput1: function(event) {
this.data.userName = event.target.value
},
onKeyInput2: function(event) {
this.data.userPhone = event.target.value
},
showing(e) {
this.page.showTextView = e
},
@@ -127,6 +149,20 @@
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);

View File

@@ -53,7 +53,8 @@
<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;">
<view v-if="data.showRecord" class="btn" style="flex-shrink: 0;color: #191919;"
@click.stop="showRecord(page.sid)">
预约记录</view>
<view v-if="data.showBtn" class="btn" style="flex-shrink: 0;color: royalblue;"
@click.stop="booking(page.sid)">预约提货
@@ -109,6 +110,11 @@
})
})
},
showRecord(sid) {
uni.navigateTo({
url: '/pages/card/card_record?sid=' + sid
})
},
booking(sid) {
uni.navigateTo({
url: '/pages/card/card_booking?sid=' + sid

View File

@@ -0,0 +1,99 @@
<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)
})
}).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%);
}
.bottom {
/* 加载背景图 */
background-image: url(../../static/card_bg1.png);
/* 让背景图基于容器大小伸缩 */
background-size: cover;
}
</style>

View File

@@ -0,0 +1,138 @@
<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>