Files
aishangjia-uniapp/sub_pages/order/delivery/me.vue
2023-08-04 13:14:48 +08:00

356 lines
7.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<!-- <view class="select-date">
<text @click="openCalendar">{{ deliveryTime }}<u-icon class="icon" name="calendar"></u-icon></text>
<u-calendar v-model="show" mode="date" :min-date="minDate" :max-date="maxDate" @change="changeDate"></u-calendar>
</view> -->
<view class="order">
<block>
<view class="title">
<text>我的取餐码</text>
<text class="desc">将此取餐码分享给微信好友即可帮你取餐<br>仅当日有效</text>
</view>
<view class="qrcode">
<image :src="qrcode"></image>
</view>
</block>
</view>
<!-- <view class="order">
<block>
<view class="title">
<text>物品档口</text>
</view>
<view class="fenqi">
<block v-for="(item,index) in entityGoods" :key="index">
<view class="item" v-if="item.totalNum > 0">
<image class="image" :src="item.imageUrl" mode="aspectFill"></image>
<view class="goods-info">
<view class="goods-name">
<text class="name">{{ item.goodsName }}</text>
<text class="selling-point">{{ item.comments }}</text>
</view>
<view class="goods-price">
<text class="price">{{ item.goodsPrice }}</text>
<text class="num"> x {{ item.totalNum }}</text>
</view>
</view>
</view>
</block>
</view>
</block>
</view> -->
<!-- <view class="submit">
<u-button type="warning" @click="generateQrCode">生成核销码</u-button>
</view> -->
<!-- <u-button @click="verificationQrCode">生成核销码</u-button> -->
<!-- <u-modal v-model="showQrCode" confirmText="取消" title="核销码">
<view><image :src="qrcode" class="qrcode"></image></view>
</u-modal> -->
</view>
</template>
<script>
import { getUser } from '@/api/user.js'
import { dateFormat } from '@/utils/util.js'
import store from '@/store'
import * as Config from '@/config.js'
import * as UserApi from '@/api/user.js'
export default {
components: {
// Search
},
data() {
return {
totalPrice: 0,
list: [],
form: {},
userId: 0,
canteenGoods: [],
entityGoods: [],
orderId: null,
orderNo: null,
deliveryTime: null,
record: {},
minDate: dateFormat('YYYY-mm-dd',new Date()),
maxDate: '2030-01-01',
deliveryTime: dateFormat('YYYY-mm-dd',new Date()), // var startDate= new Date(new Date().toLocaleDateString());
show: false,
// 正在加载中
isLoading: true,
// 当前选择的设备ID
goodsId: null,
mode: 'range',
month: 6,
agree: true,
price: {
batteryRent: 300,
batteryDeposit: 300,
batteryInsurance: 0
},
customStyle: {
marginTop: '20px', // 注意驼峰命名,并且值必须用引号包括,因为这是对象
backgroundColor: '#51b2aa'
},
showQrCode: false,
qrcode: ''
}
},
onLoad(option) {
this.getUserInfo()
},
onShow(){
this.getMyQrCode()
},
methods: {
getUserInfo() {
const { form } = this
const app = this
getUser().then(res => {
if( res.code == 0 && res.data.username != 'www') {
console.log("获取用户信息: ",res.data);
app.form = res.data
app.userInfo = res.data
app.userId = res.data.userId
store.dispatch('setUserInfo',res.data)
app.isLogin = true
}else{
app.isLogin = false
app.handleLogout()
}
})
},
getMyQrCode(){
const app = this
const userId = uni.getStorageSync('userId')
UserApi.getMyQrCode({
codeContent: 'http://apps.gxwebsoft.com/baocan/#/pages/order/delivery/others?userId=' + userId,
}).then(res => {
app.showQrCode = true
app.qrcode = res.data
})
},
onClose(){
this.showQrCode = false
},
onChangeStepper({ value }) {
this.month = value
},
change(e) {
console.log(e);
},
openCalendar(){
this.show = true
},
changeDate(date){
this.deliveryTime = date.result
this.getMyOrder()
},
onInput(month) {
this.month = month
},
onAgree(){
this.agree = !this.agree
},
showXieyi(){
this.$navTo('pages/help/xieyi')
},
copyCode(text){
// #ifndef H5
console.log("text: ",text);
uni.setClipboardData({
text: text,
success: (result) => {
this.$success("复制成功")
}
})
// #endif
// #ifdef H5
let textarea = document.createElement("textarea")
textarea.value = text
textarea.readOnly = "readOnly"
document.body.appendChild(textarea)
textarea.select() // 选中文本内容
textarea.setSelectionRange(0, info.length)
uni.showToast({ //提示
title: '复制成功'
})
result = document.execCommand("copy")
textarea.remove()
// #endif
}
}
}
</script>
<style lang="scss" scoped>
// .goods-info {
// background-color: #ffffff;
// border-radius: 12rpx;
// width: 700rpx;
// margin: 20rpx auto;
// .goods {
// padding: 20rpx;
// display: flex;
// image {
// width: 220rpx;
// height: 220rpx;
// margin: 20rpx;
// }
// .info {
// display: flex;
// flex-direction: column;
// padding: 20rpx;
// .goods-name {
// font-size: 34rpx;
// margin-bottom: 10rpx;
// }
// .goods-desc {
// font-size: 28rpx;
// color: #999999;
// }
// .selling-point{
// padding: 5px 0;
// color: #e6760e;
// }
// }
// }
// .between-time {
// width: 500rpx;
// margin: auto;
// padding-bottom: 20rpx;
// text-align: center;
// .select-slider {
// line-height: 2em;
// color: #e6760e;
// }
// }
// }
.order {
background-color: #ffffff;
border-radius: 12rpx;
width: 700rpx;
margin: 20rpx auto;
padding: 10rpx 0;
.title {
text-align: center;
font-size: 38rpx;
padding: 20rpx;
display: flex;
flex-direction: column;
justify-content: center;
.desc{
font-weight: normal;
color: #999999;
font-size: 28rpx;
}
}
.xieyi {
padding: 20rpx;
font-size: 26rpx;
}
}
.submit {
border-radius: 12rpx;
width: 700rpx;
margin: 20rpx auto;
padding: 10rpx 0;
}
.xieyi-text{
color: #0000ff;
}
.fenqi{
padding: 30rpx;
border-top: 1px solid #eee;
.item{
display: flex;
padding: 20rpx 0;
.image{
width: 160rpx;
height: 120rpx;
}
.goods-info{
width: 460rpx;
margin-left: 10rpx;
display: flex;
justify-content: space-between;
.goods-name{
text-align: left;
display: flex;
flex-direction: column;
.name{
font-weight: 500;
max-width: 300rpx;
text-overflow: -o-ellipsis-lastline;
overflow: hidden; //溢出内容隐藏
text-overflow: ellipsis; //文本溢出部分用省略号表示
display: -webkit-box; //特别显示模式
-webkit-line-clamp: 2; //行数
line-clamp: 2;
-webkit-box-orient: vertical; //盒子中内容竖直排列
}
.selling-point{
max-width: 300rpx;
color: #999999;
text-overflow: -o-ellipsis-lastline;
overflow: hidden; //溢出内容隐藏
text-overflow: ellipsis; //文本溢出部分用省略号表示
display: -webkit-box; //特别显示模式
-webkit-line-clamp: 1; //行数
line-clamp: 1;
-webkit-box-orient: vertical; //盒子中内容竖直排列
}
}
.goods-price{
display: flex;
flex-direction: column;
.price{
color: #999999;
}
.num{
text-align: right;
color: #cccccc;
}
}
}
}
}
.select-date {
text-align: center;
line-height: 2.4rem;
background-color: #ffffff;
.icon {
margin-left: 10rpx;
}
}
.on-buy{
background-color: #804002;
}
.qrcode{
padding-bottom: 40rpx;
margin: auto;
display: flex;
justify-content: center;
image{
width: 360rpx;
height: 360rpx;
}
}
</style>