新增预订商城项目

This commit is contained in:
myTest383
2024-12-02 08:51:10 +08:00
parent 2e55bab308
commit dafca7a329
539 changed files with 98459 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
<template>
<view
style="display: flex;flex-direction: column; background: #f7f7f7;height: 100%;box-sizing: border-box;position: absolute;width: 100%;">
<NavBar ref="nav" navTitle="提货人信息" :showIcon="true" :supportChange="false">
</NavBar>
<view style="display: flex;flex-direction: column; margin: 10px; border-radius: 15px; background: #fff;
padding: 10px;">
<view style="display: flex;flex-direction: row;align-items: center;">
<text style="font-size: 14px;color: #999;">提货人</text>
<input placeholder="请输入提货人" style="font-size: 25rpx;flex: 1;height: 35px;line-height: 35px;padding-left: 10px;padding-right: 10px; margin-left: 15px;
border-bottom: 1px #EFEFEF solid;padding-bottom: 1px;" :value="page.name" @input="onKeyInput1" />
</view>
<view style="display: flex;flex-direction: row;align-items: center;">
<text style="font-size: 14px;color: #999;">&ensp;&ensp;</text>
<input placeholder="请输入联系电话" type="number" maxlength="11"
style="font-size: 25rpx;flex: 1;height: 35px;line-height: 35px;padding-left: 10px;padding-right: 10px; margin-left: 15px;"
:value="page.phone" @input="onKeyInput2" />
</view>
</view>
<view
style=" width: 100%; box-sizing: border-box; padding-left: 10vw;padding-right: 10vw;display: flex;flex-direction: row; justify-content: center;align-items: center;">
<text style=" background: #FF9900;color: #fff;margin-top: 20px;margin-bottom: 20px; border-radius: 20px;
padding-top: 10px;padding-bottom: 10px;padding-left: 25vw;padding-right: 25vw; text-align: center;"
@click="confirm()">确认</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
page: {
name: "",
phone: ""
}
}
},
onLoad(options) {
this.page.name = options.name
this.page.phone = options.phone
},
methods: {
onKeyInput1(event) {
this.page.name = event.target.value
},
onKeyInput2(event) {
this.page.phone = event.target.value
},
confirm() {
uni.$emit('changePer', this.page)
uni.navigateBack()
},
}
}
</script>
<style lang="scss">
</style>

566
pages/good/goodsDetail.vue Normal file
View File

@@ -0,0 +1,566 @@
<template>
<view style="height: 100vh;background: #fff;">
<loading-state ref="pageView" @request="request">
<view style="height: 100vh;overflow: hidden;overflow-y: auto;">
<image :src="data.picUrl" style="width: 100vw;height: 80vw;" mode="scaleToFill"></image>
<view style="display: flex;flex-direction: column;background: #fff;padding: 20px 20px 0px 20px;margin-top: 10px;
border-top-left-radius: 20px;border-top-right-radius: 20px;height: 100%;">
<view style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;">
<text
style="font-size: 18px;font-weight: 600;font-family: sans-serif;color: #333;">{{data.name}}</text>
<text style="font-size: 13px;color: #FF7A11;">{{data.price}}</text>
</view>
<view style="display: flex;flex-direction: row;justify-content: space-between;margin-top: 10px;">
<text style="font-size: 13px;color: #666;">&ensp;&ensp;&ensp;&ensp;</text>
<text
style="font-size: 13px;color: #999;">{{data.weight}}{{data.specificationUnit}}/{{data.unitName}}</text>
</view>
<view style="display: flex;flex-direction: row;justify-content: space-between;margin-top: 10px;">
<text style="font-size: 13px;color: #666;">&ensp;&ensp;&ensp;&ensp;</text>
<text style="font-size: 13px;color: #999;">{{data.remarks}}</text>
</view>
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 20px;">
<view style="width: 2px;height: 15px;background: #61CB29;margin-right: 10px;"></view>
<text style="font-size: 14px;font-weight: 600;font-family: sans-serif;color: #333;">商品详情</text>
</view>
<view style="margin-top: 10px;" v-show="!data.appContent==''">
<rich-text :nodes="data.appContent | formatRichText"></rich-text>
</view>
</view>
</view>
</loading-state>
<!-- <view
style="position: absolute; bottom: 0px; display: flex;flex-direction: column;width: 100%;
box-sizing: border-box; padding-left: 16px;padding-right: 16px;background: #fff; height: 12vh;border-top: 1px solid #EFEFEF;"> -->
<!-- <view
style="display: flex;flex-direction: row;align-items: center; justify-content: center; margin-top:10px;">
<view id="bomView" style="display: flex;flex-direction: row;align-items: center;">
<view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
温馨提示已订</view>
<view style="color: #FF5006;font-size: 15px;height: 15px;line-height: 15px;font-weight: bold;">
{{page.weight}}
</view>
<view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
{{data.qssl}}斤起订</view>
<view style="display: flex;flex-direction: row;align-items: center;" @click="showPop2()">
<text
style="color: #6190D8;font-size: 13px;height: 10px;line-height: 10px;margin-top: 5px;text-decoration:underline;font-style:oblique;">
起订说明</text>
<text
style="color: #6190D8;font-size: 13px;height: 10px;line-height: 10px;margin-top: 5px;margin-left: 2px;">
>></text>
</view>
</view>
</view> -->
<!-- <view
style="display: flex;flex-direction: row; justify-content: center;align-items: center;margin-top: 10px;padding: 0px 10px;margin-bottom: 20px;">
<text style="background: #FF9900; color: #fff;font-size: 14px; padding: 0px 15px;height: 50px;line-height:50px;flex: 1;text-align: center;
border: 1px #FF9900 solid; border-radius: 25px;" @click="showDialog()">加入购物车</text> -->
<!-- <view style="border: 1px #FF9900 solid;border-top-right-radius: 25px; border-bottom-right-radius: 25px;padding: 0px 5px;height: 50px;line-height:50px;flex: 1;
display: flex;flex-direction: row;align-items: center;box-sizing: border-box;justify-content: center;"
@click="gotoCart()">
<image src="../../static/shoppCart_icon.png" mode="aspectFill"
style="height: 20px;width: 20px;flex-shrink: 0;">
</image>
<view style="display: flex;flex-direction: column;justify-content: center;align-items: center;">
<text
style="font-size: 15px;color: #FF5006;margin-left: 5px;height: 20px;line-height: 20px;margin-top: 5px;font-weight: bold;">{{page.price}}</text>
<text v-if="page.remarks!=''"
style="font-size: 10px;color: #666;margin-left: 5px; height: 10px;line-height: 10px;margin-bottom: 5px;">{{page.remarks}}</text>
</view>
</view> -->
<!-- </view> -->
<!-- </view> -->
<!-- 弹窗蒙版 -->
<view class="model" catchtouchmove='preventTouchMove' v-if='showModal'></view>
<view class="modalDlg" catchtouchmove='preventTouchMove' v-if='showModal'>
<view style="display: flex;flex-direction: row;padding: 16px 20px;margin-top: 10px;">
<image :src="data.picUrl" style="width: 90px;height: 90px;border-radius: 10px;" mode="scaleToFill">
</image>
<view style="display: flex;flex-direction: column;flex: 1;margin-left: 15px;">
<view style="display: flex;flex-direction: row;">
<text style="flex: 1;margin-right: 10px;">{{data.name}}</text>
<image src="../../static/close2.png" style="width: 22px;height: 22px;" @click="colseDialog()">
</image>
</view>
<view style="display: flex;flex-direction: row;margin-top: 8px;">
<text
style="color: #EE752F;border: 1px #EE752F solid;
border-radius: 8px;padding: 1px 10px;font-size: 10px;">{{data.weight}}{{data.specificationUnit}}/{{data.unitName}}</text>
<text style="margin-left: 10px;color: #EE752F;border: 1px #EE752F solid;
border-radius: 8px;padding: 1px 10px;font-size: 10px;">{{data.remarks}}</text>
</view>
<!-- <text style="font-size: 12px;color: #E36443;margin-top: 8px;">提货截止日{{data.periodValidity}}</text> -->
<text style="font-size: 12px;color: #E36443;margin-top: 8px;">{{data.price}}</text>
</view>
</view>
<view
style="display: flex;flex-direction: row;margin-top:10px;justify-content: space-between;padding: 16px 20px;">
<text style="font-size: 16px;font-weight: 600;font-family: sans-serif;">数量</text>
<view style="display: flex;flex-direction: row;align-items: center;">
<image src="../../static/jian_icon.png" mode="aspectFill" style="width: 25px;height: 25px;"
@click.stop="jian(data)">
</image>
<text style="font-size: 16px;padding:5px; margin-left: 8px;margin-right: 8px;"
@click.stop="numberClick(data)">{{data.goodsNumber}}</text>
<image src="../../static/jia_icon.png" mode="aspectFill" style="width: 25px;height: 25px;"
@click.stop="jia(data)">
</image>
</view>
</view>
<view style="position: absolute; bottom: 0px; display: flex;flex-direction: column;width: 100%;
box-sizing: border-box; padding-left: 16px;padding-right: 16px;background: #fff; height: 12vh;
border-top: 1px solid #EFEFEF;">
<!-- <view
style="display: flex;flex-direction: row;align-items: center; justify-content: center; margin-top:10px;">
<view id="bomView" style="display: flex;flex-direction: row;align-items: center;">
<view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
温馨提示已订</view>
<view style="color: #FF5006;font-size: 15px;height: 15px;line-height: 15px;font-weight: bold;">
{{page.weight}}
</view>
<view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
{{data.qssl}}斤起订</view>
<view style="display: flex;flex-direction: row;align-items: center;" @click="showPop2()">
<text
style="color: #6190D8;font-size: 13px;height: 10px;line-height: 10px;margin-top: 5px;text-decoration:underline;font-style:oblique;">
起订说明</text>
<text
style="color: #6190D8;font-size: 13px;height: 10px;line-height: 10px;margin-top: 5px;margin-left: 2px;">
>></text>
</view>
</view>
</view> -->
<view
style="display: flex;flex-direction: row; justify-content: center;align-items: center;margin-top: 10px;padding: 0px 10px;margin-bottom: 20px;">
<text style="background: #FF9900; color: #fff;font-size: 14px; padding: 0px 15px;height: 50px;line-height:50px;flex: 1;text-align: center;
border: 1px #FF9900 solid; border-radius: 25px;" @click="upDateShoppCart()">加入购物车</text>
</view>
</view>
</view>
<!-- 输入数量 -->
<view class="model" catchtouchmove='preventTouchMove' v-if='showModal1'></view>
<view class="modalDlg4" catchtouchmove='preventTouchMove' v-if='showModal1'>
<view
style="display: flex;flex-direction: column;background: #fff; width: 80%; border-radius: 20px;box-sizing: border-box;">
<input type="number" placeholder="请输入数量" v-model="data.goodsNumber"
style="margin: 20px;border: 1px #bbb solid; padding: 5px;line-height: 30px;height: 30px;border-radius: 6px;" />
<view
style="flex-shrink: 0;display: flex;flex-direction: row;align-items: center;justify-content: center;">
<button class="button1" @click="colseDialog1()">取消</button>
<button class="button2" @click="saveNum()">确定</button>
</view>
</view>
</view>
<uni-popup ref="inputDialog2" type="dialog">
<uni-popup-dialog ref="inputClose" mode="more" title="起订说明" :showConfirm="true"
:beforeClose="dialogBeforeClose2" @confirm="dialogInputConfirm2"
:content="data.qdxy"></uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
showModal: false,
showModal1: false,
page: {
sid: '',
weight: "",
remarks: "",
price: ""
},
data: {
picUrl: '',
name: '',
price: '',
remarks: '',
appContent: ""
},
dialogContent: "这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容这里是协议内容,这里是协议内容",
confirmText: "我知道了5s",
dialogBeforeClose: false,
dialogBeforeClose2: false,
countdown: 5,
}
},
onLoad(options) {
this.page.sid = options.sid
},
onShow() {
this.request()
},
filters: {
/**
* 处理富文本里的图片宽度自适应
* 1.去掉img标签里的style、width、height属性
* 2.img标签添加style属性max-width:100%;height:auto
* 3.修改所有style里的width属性为max-width:100%
* 4.去掉<br/>标签
* @param html
* @returns {void|string|*}
*/
formatRichText(html) {
//控制小程序中图片大小
if (html) {
let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
return match;
});
newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) {
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi,
'max-width:100%;');
return match;
});
newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi,
'<img style="max-width:100%;height:auto;display:block;margin:10rpx auto;"');
return newContent;
} else {
return '暂无商品详情';
}
},
},
methods: {
showDialog() {
this.showModal = true
},
colseDialog() {
this.showModal = false
},
colseDialog1() {
this.showModal1 = false
},
saveNum() {
this.showModal1 = false
},
jian(item) {
if (Number(item.goodsNumber) > 0) {
item.goodsNumber = Number(item.goodsNumber) - 1
}
},
jia(item) {
item.goodsNumber = Number(item.goodsNumber) + 1
},
numberClick(item) {
this.showModal1 = true
},
request() {
var params = {
customerSid: getApp().globalData.sid,
sid: this.page.sid,
}
console.log("request", params);
let _this = this
_this.$api.goodsDetail(params).then((resp) => {
// console.log(resp);
_this.data = resp
_this.getAllPriceOrWeight()
// _this.$nextTick(() => {
// _this.$refs.pageView.setLoadState(2)
// })
}).catch(e => {
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
},
getAllPriceOrWeight() {
let _this = this
var params = {
customerSid: getApp().globalData.sid,
brandId: _this.data.brandId,
}
console.log("getGoodsWeight", params);
_this.$api.getGoodsWeight(params).then((resp) => {
console.log("getGoodsWeight", resp);
_this.page.price = resp.totalPrice
_this.page.weight = resp.totalWeight
_this.page.remarks = resp.remarks
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(2)
})
}).catch(e => {
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
},
inCart() {
// this.data.goodsNumber = Number(this.data.goodsNumber) + 1
this.upDateShoppCart()
},
upDateShoppCart() {
var good = {
goodsSid: this.data.sid,
goodsName: this.data.name,
goodsNumber: this.data.goodsNumber,
affiliation: this.data.brandId,
price: this.data.mefenPrice,
weight: this.data.weight,
customerSid: getApp().globalData.sid
}
let _this = this
console.log("upDateShoppCart", good);
_this.$api.addShoppingCart(good).then((resp) => {
_this.shortToast('已加入购物车。')
_this.getAllPriceOrWeight()
_this.showModal = false
uni.navigateBack()
}).catch(e => {
_this.showModal = false
})
},
settlement() {
// 支付
if (this.page.weight < parseInt(this.data.qssl)) {
this.shortToast('满' + this.data.qssl + '斤才可定制云菜窖哦,请继续选菜吧。')
return
}
this.showPop()
},
showPop() {
this.$refs.inputDialog.open()
let timeOut = setInterval(() => {
if (this.countdown == 1) {
this.confirmText = "确定"
this.countdown = 5
this.dialogBeforeClose = false
clearInterval(timeOut)
} else {
this.dialogBeforeClose = true
this.countdown = this.countdown - 1;
this.confirmText = "我知道了" + "" + this.countdown + "s"
}
}, 1000)
},
saveGoods() {
var params = {
customerSid: getApp().globalData.sid,
// cardNumber: 1,
brandId: this.data.brandId,
totalTee: this.page.price,
// ordOrderDetailsVoList: list
}
console.log("params", params);
let _this = this
_this.$api.createVegeOrder(params).then((resp) => {
// console.log("resp", resp);
this.$pay(resp)
}).catch(e => {})
},
gotoCart() {
uni.navigateTo({
url: 'shoppCart?affiliation=' + this.data.brandId + "&weight=" + this.data.qssl + "&qdxy=" +
this.data.qdxy
})
},
showPop2() {
this.$refs.inputDialog2.open()
},
dialogInputConfirm(val) {
if (this.confirmText == "确定") {
this.confirmText = "我知道了5s",
this.dialogBeforeClose = true,
this.countdown = 5
this.saveGoods()
}
},
dialogInputConfirm2(val) {
console.log(">>>>>>>>>>>", this.dialogBeforeClose2);
this.dialogBeforeClose2 = false
},
}
}
</script>
<style>
uni-page-body,
page {
background: #f3f4f6;
}
/* 弹窗样式 */
.model {
position: absolute;
width: 100%;
height: 100%;
background: #000;
z-index: 1;
opacity: 0.5;
top: 0;
left: 0;
}
.modalDlg {
/* 设置超出滚动 */
overflow: auto;
width: 100%;
position: fixed;
top: 70vw;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
background-color: #fff;
border-top-right-radius: 20px;
border-top-left-radius: 20px;
display: flex;
flex-direction: column;
}
.modalDlg4 {
/* 设置超出滚动 */
overflow: auto;
position: fixed;
z-index: 2;
display: flex;
width: 100%;
height: 100%;
top: 0;
left: 0;
flex-direction: column;
justify-content: center;
align-items: center;
}
button::after {
border: 0;
}
.button1 {
background: #fff;
color: #666;
flex: 1;
border-radius: 0px;
border-bottom-left-radius: 20px;
border: 1px solid #eee;
}
.button2 {
background: #fff;
color: #FF9900;
border-radius: 0px;
border-bottom-right-radius: 20px;
flex: 1;
border: 1px solid #eee;
}
</style>

351
pages/good/goodsDetail2.vue Normal file
View File

@@ -0,0 +1,351 @@
<template>
<view style="height: 100vh;background: #fff;">
<loading-state ref="pageView" @request="request">
<view style="height: 100vh;overflow: hidden;overflow-y: auto;">
<image :src="data.picUrl" style="width: 100vw;height: 80vw;" mode="aspectFill"></image>
<view style="display: flex;flex-direction: column;background: #fff;padding: 20px 20px 0px 20px;margin-top: 10px;
border-top-left-radius: 20px;border-top-right-radius: 20px;height: 100%;">
<view style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;">
<text
style="font-size: 18px;font-weight: 600;font-family: sans-serif;color: #333;">{{data.name}}</text>
<text style="font-size: 13px;color: #FF7A11;">{{data.price}}</text>
</view>
<view style="display: flex;flex-direction: row;justify-content: space-between;margin-top: 10px;">
<text style="font-size: 13px;color: #666;">&ensp;&ensp;&ensp;&ensp;</text>
<text
style="font-size: 13px;color: #999;">{{data.weight}}{{data.specificationUnit}}/{{data.unitName}}</text>
</view>
<view style="display: flex;flex-direction: row;justify-content: space-between;margin-top: 10px;">
<text style="font-size: 13px;color: #666;">&ensp;&ensp;&ensp;&ensp;</text>
<text style="font-size: 13px;color: #999;">{{data.remarks}}</text>
</view>
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 20px;">
<view style="width: 2px;height: 15px;background: #FF7A11;margin-right: 10px;"></view>
<text style="font-size: 14px;font-weight: 600;font-family: sans-serif;color: #333;">商品详情</text>
</view>
<view style="margin-top: 10px;" v-show="!data.appContent==''">
<rich-text :nodes="data.appContent | formatRichText"></rich-text>
</view>
</view>
</view>
</loading-state>
<!-- <view style="position: absolute; bottom: 0px; display: flex;flex-direction: column;width: 100%;
box-sizing: border-box; padding-left: 16px;padding-right: 16px;background: #fff; height: 13vh;">
<view
style="display: flex;flex-direction: row;align-items: center; justify-content: center; margin-top:10px;">
<view id="bomView" style="display: flex;flex-direction: row;align-items: center;">
<view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
温馨提示已订</view>
<view style="color: #FF5006;font-size: 15px;height: 15px;line-height: 15px;font-weight: bold;">
{{page.weight}}
</view>
<view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
{{data.qssl}}斤起订</view>
<view style="display: flex;flex-direction: row;align-items: center;" @click="showPop2()">
<text
style="color: #6190D8;font-size: 13px;height: 10px;line-height: 10px;margin-top: 5px;text-decoration:underline;font-style:oblique;">
起订说明</text>
<text
style="color: #6190D8;font-size: 13px;height: 10px;line-height: 10px;margin-top: 5px;margin-left: 2px;">
>></text>
</view>
</view>
</view>
<view
style="display: flex;flex-direction: row; justify-content: center;align-items: center;margin-top: 10px;padding: 0px 10px;margin-bottom: 20px;">
<text style="background: #FF9900; color: #fff;font-size: 13px; padding: 0px 15px;height: 40px;line-height: 40px;
border: 1px #FF5006 solid; border-top-left-radius: 25px; border-bottom-left-radius: 25px;flex-shrink: 0;"
@click="inCart()">加入购物车</text>
<view style="border: 1px #FF5006 solid;margin-left: 5px;margin-right: 5px;padding: 0px 5px;height: 42px;flex: 1;
display: flex;flex-direction: row;align-items: center;box-sizing: border-box;" @click="gotoCart()">
<image src="../../static/shoppCart_icon.png" mode="aspectFill"
style="height: 20px;width: 20px;flex-shrink: 0;">
</image>
<view style="display: flex;flex-direction: column;flex: 1;">
<text
style="font-size: 15px;color: #FF5006;margin-left: 5px;height: 20px;line-height: 20px;margin-top: 5px;font-weight: bold;">{{page.price}}</text>
<text v-if="page.remarks!=''"
style="font-size: 10px;color: #666;margin-left: 5px; height: 10px;line-height: 10px;margin-bottom: 5px;">{{page.remarks}}</text>
</view>
</view>
<text style="background: #FF9900; color: #fff;font-size: 13px; padding: 0px 15px;height: 40px;line-height: 40px;
border: 1px #FF5006 solid; border-top-right-radius: 25px; border-bottom-right-radius: 25px;flex-shrink: 0;"
@click="settlement()">结算</text>
</view>
</view>
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="more" title="订购协议" :showConfirm="true"
:beforeClose="dialogBeforeClose" @confirm="dialogInputConfirm" :content="data.dgxy"
:confirm-text="confirmText"></uni-popup-dialog>
</uni-popup>
<uni-popup ref="inputDialog2" type="dialog">
<uni-popup-dialog ref="inputClose" mode="more" title="起订说明" :showConfirm="true"
:beforeClose="dialogBeforeClose2" @confirm="dialogInputConfirm2"
:content="data.qdxy"></uni-popup-dialog>
</uni-popup> -->
</view>
</template>
<script>
export default {
data() {
return {
page: {
sid: '',
weight: "",
remarks: "",
price: ""
},
data: {
picUrl: '',
name: '',
price: '',
remarks: '',
appContent: ""
},
dialogContent: "这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容,这里是协议内容这里是协议内容,这里是协议内容",
confirmText: "我知道了5s",
dialogBeforeClose: false,
dialogBeforeClose2: false,
countdown: 5,
}
},
onLoad(options) {
this.page.sid = options.sid
},
onShow() {
this.request()
},
filters: {
/**
* 处理富文本里的图片宽度自适应
* 1.去掉img标签里的style、width、height属性
* 2.img标签添加style属性max-width:100%;height:auto
* 3.修改所有style里的width属性为max-width:100%
* 4.去掉<br/>标签
* @param html
* @returns {void|string|*}
*/
formatRichText(html) {
//控制小程序中图片大小
if (html) {
let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
return match;
});
newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) {
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi,
'max-width:100%;');
return match;
});
newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi,
'<img style="max-width:100%;height:auto;display:block;margin:10rpx auto;"');
return newContent;
} else {
return '暂无商品详情';
}
},
},
methods: {
request() {
var params = {
customerSid: getApp().globalData.sid,
sid: this.page.sid,
}
console.log("request", params);
let _this = this
_this.$api.goodsDetail(params).then((resp) => {
// console.log(resp);
_this.data = resp
_this.getAllPriceOrWeight()
// _this.$nextTick(() => {
// _this.$refs.pageView.setLoadState(2)
// })
}).catch(e => {
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
},
getAllPriceOrWeight() {
let _this = this
var params = {
customerSid: getApp().globalData.sid,
brandId: _this.data.brandId,
}
console.log("getGoodsWeight", params);
_this.$api.getGoodsWeight(params).then((resp) => {
console.log("getGoodsWeight", resp);
_this.page.price = resp.totalPrice
_this.page.weight = resp.totalWeight
_this.page.remarks = resp.remarks
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(2)
})
}).catch(e => {
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
},
inCart() {
this.data.goodsNumber = Number(this.data.goodsNumber) + 1
this.upDateShoppCart()
},
upDateShoppCart() {
var good = {
goodsSid: this.data.sid,
goodsName: this.data.name,
goodsNumber: this.data.goodsNumber,
affiliation: this.data.brandId,
price: this.data.mefenPrice,
weight: this.data.weight,
customerSid: getApp().globalData.sid
}
let _this = this
_this.$api.addShoppingCart(good).then((resp) => {
_this.shortToast('已加入购物车。')
_this.getAllPriceOrWeight()
}).catch(e => {
})
},
settlement() {
// 支付
if (this.page.weight < parseInt(this.data.qssl)) {
this.shortToast('满' + this.data.qssl + '斤才可定制云菜窖哦,请继续选菜吧。')
return
}
this.showPop()
},
showPop() {
this.$refs.inputDialog.open()
let timeOut = setInterval(() => {
if (this.countdown == 1) {
this.confirmText = "确定"
this.countdown = 5
this.dialogBeforeClose = false
clearInterval(timeOut)
} else {
this.dialogBeforeClose = true
this.countdown = this.countdown - 1;
this.confirmText = "我知道了" + "" + this.countdown + "s"
}
}, 1000)
},
saveGoods() {
var params = {
customerSid: getApp().globalData.sid,
// cardNumber: 1,
brandId: this.data.brandId,
totalTee: this.page.price,
// ordOrderDetailsVoList: list
}
console.log("params", params);
let _this = this
_this.$api.createVegeOrder(params).then((resp) => {
// console.log("resp", resp);
this.$pay(resp)
}).catch(e => {})
},
gotoCart() {
uni.navigateTo({
url: 'shoppCart?affiliation=' + this.data.brandId + "&weight=" + this.data.qssl + "&qdxy=" +
this.data.qdxy
})
},
showPop2() {
this.$refs.inputDialog2.open()
},
dialogInputConfirm(val) {
if (this.confirmText == "确定") {
this.confirmText = "我知道了5s",
this.dialogBeforeClose = true,
this.countdown = 5
this.saveGoods()
}
},
dialogInputConfirm2(val) {
console.log(">>>>>>>>>>>", this.dialogBeforeClose2);
this.dialogBeforeClose2 = false
},
}
}
</script>
<style>
uni-page-body,
page {
background: #f3f4f6;
}
</style>

396
pages/good/reservation.vue Normal file
View File

@@ -0,0 +1,396 @@
<template>
<view style="width: 100%;height: 100%;background: #60CA2C;display: flex;flex-direction: column;">
<NavBar ref="nav" navTitle="预约提货" :showIcon="true" :supportChange="false">
</NavBar>
<loading-state ref="pageView" @request="request">
<!-- <view style="background: #FFA35A;width: 100%;height: 100%;"> -->
<view style="display: flex;flex-direction: column;background: #F2F2F2; width: 100%;
border-radius: 25px;height: 100vh; padding: 10px;box-sizing: border-box;">
<view style="display: flex;flex-direction: column;background: #fff;
border-radius: 15px;padding: 15px 10px;">
<view v-if="info.storeSid!=''"
style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;">
<text
style="font-size: 16px;color: #000; font-weight: 600;font-family: sans-serif;">{{info.storeName}}</text>
<view style="display: flex;flex-direction: row;align-items: center;" @click="address()">
<text style="font-size: 12px;color: #FF9900;">切换</text>
<image src="../../static/right_icon.png" style="width: 15px;height: 15px;margin-left: 5px;">
</image>
</view>
</view>
<view v-if="info.storeSid==''"
style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;">
<text
style="font-size: 16px;color: #000; font-weight: 600;font-family: sans-serif;">暂无提货点信息</text>
<view style="display: flex;flex-direction: row;align-items: center;" @click="address()">
<text style="font-size: 12px;color: #FF9900;">去完善</text>
<image src="../../static/right_icon.png" style="width: 15px;height: 15px;margin-left: 5px;">
</image>
</view>
</view>
<view v-if="info.storeSid!=''"
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: #666;font-size: 14px;">{{info.businessHours}}</text>
</view>
<view v-if="info.storeSid!=''"
style="display: flex;flex-direction: row;align-items: center;margin-top: 15px;">
<image src="https://supervise.yxtsoft.com/lpk/image/location.png"
style="width: 20px;height: 20px;">
</image>
<text style="margin-left: 5px;flex: 1; color: #666;font-size: 14px;">{{info.address}}</text>
</view>
<view
style="display: flex;flex-direction: row;align-items: center;justify-content: center;margin-top: 16px;">
<text
style="font-size: 14px;color: #000; font-weight: 600;font-family: sans-serif; flex: 1;">提货时间</text>
<uni-datetime-picker type="date" v-model="info.reserveDate" :start="info.start"
:clearIcon="false" :border="false" :end="info.end" :disabledDate="disabledDate" />
<image src="../../static/right_icon.png" style="width: 15px;height: 15px;margin-left: 5px;">
</image>
</view>
</view>
<view style="margin-top: 10px;display: flex;flex-direction: row;background: #fff;align-items: center;
border-radius: 15px;padding: 15px 10px;justify-content: space-between;">
<text style="font-size: 14px;color: #000; font-weight: 600;font-family: sans-serif;">提货人</text>
<view v-if="info.name!=''" style="display: flex;flex-direction: row;align-items: center;"
@click="changePer()">
<text
style="font-size: 14px;color: #000; font-weight: 600;font-family: sans-serif;">{{info.name}}</text>
<text style="font-size: 12px;color: #999; margin-left: 8px;">{{info.phone}}</text>
<image src="../../static/right_icon.png" style="width: 15px;height: 15px;margin-left: 5px;">
</image>
</view>
<view v-if="info.name==''" style="display: flex;flex-direction: row;align-items: center;"
@click="changePer()">
<text style="font-size: 12px;color: #999; margin-left: 8px;">去完善</text>
<image src="../../static/right_icon.png" style="width: 15px;height: 15px;margin-left: 5px;">
</image>
</view>
</view>
<view
style="margin-top: 10px;display: flex;flex-direction: column;background: #fff;border-radius: 15px;padding: 10px;">
<text style="font-size: 15px; color: #000; font-weight: 600;font-family: sans-serif;">提货列表</text>
<scroll-view scroll-y="true" style="max-height:calc(100vh - 450px); width: 100%; box-sizing: border-box; margin-top: 10px;;
" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
<view style="width: 100%; display: flex;flex-direction: column; margin-top: 10px;">
<view v-for="(item,index) in pickingUpGoods"
style="display: flex;flex-direction: column;justify-content: center;width: 100%; margin-top: 15px; ">
<view style="display: flex;flex-direction: row;align-items: center;width: 100%; ">
<image :src="item.iconUrl" @click="itemClick(item.goodsSid)"
style="width: 90px;height: 90px; border-radius: 10px; " mode="aspectFill">
</image>
<view
style="display: flex;flex-direction: column;flex: 1; padding-bottom: 15px; margin-left: 10px;"
:style="{'border-bottom':(index == pickingUpGoods.length-1 ? 'none' : '1px #EFEFEF solid')}">
<text style="font-size: 13px;color: #000;"
@click="itemClick(item.goodsSid)">{{item.name}}</text>
<text
style="font-size: 10px;color: #999;margin-top: 5px;">{{item.remark}}</text>
<view
style="display: flex;flex-direction: row;align-items: center;margin-top: 8px;">
<text
style="border: 1px #EE752F solid; border-radius: 5px; padding: 0px 8px;
font-size: 10px;color: #EE752F; margin-right: 10px; ">{{item.weight}}{{item.specificationUnit}}/{{item.unitName}}</text>
<text
style="border: 1px #EE752F solid; background: #FF9900; color: #fff; font-size: 10px;border-radius: 5px; padding: 0px 8px;"
v-if="item.type=='0'">百姓菜!</text>
<text
style="border: 1px #3AA15F solid; background: #40C772; color: #fff; font-size: 10px;border-radius: 5px; padding: 0px 8px;"
v-if="item.type=='1'">精品菜!</text>
<text
style="border: 1px #1D60C7 solid; background: #2489F7; color: #fff; font-size: 10px;border-radius: 5px; padding: 0px 8px;"
v-if="item.type=='2'">企业菜!</text>
</view>
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between; margin-top: 15px;
margin-right: 15px;">
<view style="display: flex;flex-direction: row;align-items: center;">
<text style="font-size: 12px;color: #FF5006;">存量</text>
<text
style="font-size: 14px;color: #FF5006;">{{item.goodsNumber}}{{item.unitName}}</text>
</view>
<view style="display: flex;flex-direction: row;align-items: center;">
<image src="../../static/jian_icon.png" mode="aspectFill"
style="width: 20px;height: 20px;" @click.stop="jian(item)">
</image>
<text
style="font-size: 14px;margin-left: 8px;margin-right: 8px;">{{item.count}}</text>
<image src="../../static/jia_icon.png" mode="aspectFill"
style="width: 20px;height: 20px;" @click.stop="jia(item)">
</image>
</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<view
style="position: fixed;bottom: 0; width: 100%; box-sizing: border-box; padding-left: 10vw;padding-right: 10vw;display: flex;flex-direction: row; justify-content: center;align-items: center;">
<text style=" background: #60CA2C;color: #fff;margin-bottom: 20px; border-radius: 20px;
padding-top: 10px;padding-bottom: 10px;padding-left: 25vw;padding-right: 25vw; text-align: center;"
@click="congirmExtract()">确认提货</text>
</view>
</view>
<!-- </view> -->
</loading-state>
</view>
</template>
<script>
export default {
data() {
return {
affiliation: "",
info: {
},
pickingUpGoods: [],
disabledDate: [
// '2023-12-16'
],
btnDisabled: false
}
},
onLoad(options) {
uni.$on("address", (e) => {
// 相当与下拉刷新
this.info.storeSid = e.sid;
this.info.storeName = e.name;
this.info.businessHours = e.businessHours;
this.info.address = e.address;
})
uni.$on("changePer", (e) => {
// 相当与下拉刷新
this.info.name = e.name;
this.info.phone = e.phone;
})
this.request()
this.getSun()
this.pickingUpGoods = JSON.parse(decodeURIComponent(options.pickingUpGoods))
this.affiliation = options.affiliation
console.log(">>>>>", options);
console.log(">>>>>", this.pickingUpGoods);
console.log(">>>>>", this.affiliation);
},
onUnload() {
uni.$off('address');
uni.$off('changePer');
},
methods: {
itemClick(goodsSid) {
uni.navigateTo({
url: '/pages/good/goodsDetail?sid=' + goodsSid
})
},
getSun() {
let _this = this
_this.$api.getExtractSaturAndSun().then((resp) => {
_this.disabledDate = resp
}).catch(e => {
})
},
address() {
uni.navigateTo({
url: '/pages/SelectAddressActivity'
})
},
changePer() {
uni.navigateTo({
url: '/pages/good/changePersonnel?name=' + this.info.name + "&phone=" + this.info.phone
})
},
// 获取数据
request() {
let _this = this
_this.$api.getStoreBySid(getApp().globalData.sid).then((resp) => {
_this.info = resp
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(2)
})
}).catch(e => {
console.log(e);
})
},
jian(item) {
console.log("item》》》》", item)
const that = this
if (Number(item.count) == 1) {
wx.showModal({
content: '确定不要了吗',
cancelText: "再想想",
confirmText: "删除",
confirmColor: "#FF9900",
success(res) {
if (res.confirm) {
console.log('用户点击确定')
item.count = 0
const index = that.pickingUpGoods.findIndex((info) => info.goodsSid === item
.goodsSid)
console.log("index》》》》", index)
that.pickingUpGoods.splice(index, 1)
} else if (res.cancel) {
}
}
})
} else {
if (Number(item.count) > 0) {
item.count = Number(item.count) - 1
}
}
},
jia(item) {
if (item.count < item.goodsNumber)
item.count = Number(item.count) + 1
},
congirmExtract() {
let _this = this
if (this.btnDisabled) {
this.shortToast('请勿重复点击')
return
}
this.btnDisabled = true
if (_this.info.storeSid == '') {
this.shortToast('请完善提货点信息')
return
}
if (_this.info.reserveDate == '') {
this.shortToast('请选择日期')
return
}
if (this.info.name == "" || this.info.phone == '') {
this.shortToast('请完善提菜人信息')
return
}
let list = []
for (var i = 0; i < this.pickingUpGoods.length; i++) {
var item = this.pickingUpGoods[i]
if (item.count > 0)
list.push({
goodsSid: item.goodsSid,
select: item.count,
})
}
// console.log("ddd", list);
if (list.length == 0) {
this.shortToast('请添加商品')
return
}
var params = {
customerSid: getApp().globalData.sid,
affiliation: _this.affiliation,
reserveDate: _this.info.reserveDate,
storeSid: _this.info.storeSid,
userName: _this.info.name,
userPhone: _this.info.phone,
goodsVos: list
}
console.log("pppp", params);
_this.$api.submissionExtract(params).then((resp) => {
uni.navigateBack()
_this.btnDisabled = false
}).catch(e => {
console.log(e);
_this.btnDisabled = false
})
},
}
}
</script>
<style>
</style>

373
pages/good/shoppCart.vue Normal file
View File

@@ -0,0 +1,373 @@
<template>
<view style="height: 100vh; width: 100%; background: #F2F2F2;
display: flex;flex-direction: column;overflow: scroll;">
<loading-state ref="pageView" @request="request">
<!-- <scroll-view scroll-y="true" style="min-height: calc(100% - 15vw); width: 100%; margin-top: 10px;"
bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll"> -->
<view style="width: 100%; display: flex;flex-direction: column;">
<view v-for="(item,index) in data" style="display: flex;flex-direction: column;justify-content: center; margin: 10px 10px 0px 10px;
padding: 10px; border-radius: 15px; background-color: #fff; ">
<view style="display: flex;flex-direction: row;align-items: center;width: 100%; ">
<image :src="item.iconUrl" @click="itemClick(item.goodsSid)"
style="width: 90px;height: 90px; border-radius: 10px; " mode="aspectFill"></image>
<view style="display: flex;flex-direction: column;flex: 1;
margin-left: 10px;">
<text style="font-size: 13px;color: #000;"
@click="itemClick(item.goodsSid)">{{item.goodsName}}</text>
<text style="font-size: 10px;color: #999;margin-top: 5px;">{{item.remarks}}</text>
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 8px;">
<text style="border: 1px #EE752F solid; border-radius: 5px; padding: 0px 8px;
font-size: 10px;color: #EE752F;">{{item.jprice}}/{{item.specificationUnit}}</text>
<text
style="border: 1px #EE752F solid; border-radius: 5px; padding: 0px 8px;
font-size: 10px;color: #EE752F; margin-left: 10px; margin-right: 10px; ">{{item.weight}}{{item.specificationUnit}}/{{item.unitName}}</text>
<!-- <text
style="background: #FF9900; color: #fff; font-size: 10px;padding: 0px 8px; border-radius: 5px;">{{item.mefenPrice}}</text> -->
</view>
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between; margin-top: 15px;
margin-right: 15px;">
<text style="font-size: 14px;color: #FF5006;">{{item.price}}</text>
<view style="display: flex;flex-direction: row;align-items: center;">
<image src="../../static/jian_icon.png" mode="aspectFill"
style="width: 20px;height: 20px;" @click.stop="jian(item)"></image>
<text
style="font-size: 14px;margin-left: 8px;margin-right: 8px;">{{item.goodsNumber}}</text>
<image src="../../static/jia_icon.png" mode="aspectFill"
style="width: 20px;height: 20px;" @click.stop="jia(item)"></image>
</view>
</view>
</view>
</view>
</view>
<view style="height: 150px; background: #F2F2F2;"></view>
</view>
<view v-if="notData" style="display: flex;flex-direction: column;align-items: center;margin-top: -30vw;">
<image src="https://supervise.yxtsoft.com/lpk/image/not_Cart.png" mode="aspectFit"
style="width: 50vw;height: 50vw;"></image>
<view style="display: flex;flex-direction: column;align-items: center;margin-top: 10px;">
<text style="font-size: 14px; color: #666;margin-right: 5px;">购菜车是空的</text>
<text style="font-size: 14px;color: #fff;padding: 8px 40px; border-radius: 20px;
background: -webkit-linear-gradient(left,#FFC369,#FF9901);margin-top: 10px;" @click="gotoShopp()">去逛逛</text>
</view>
</view>
<!-- </scroll-view> -->
<view style=" width: 100%; display: flex;flex-direction: column;position: fixed;bottom: 0;overflow:hidden;
justify-content: center;align-items: center; background: #fff;padding-top: 10px;">
<view id="bomView" style="display: flex;flex-direction: row;align-items: center;">
<view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
温馨提示已订</view>
<view style="color: #FF5006;font-size: 15px;height: 15px;line-height: 15px;font-weight: bold;">
{{page.weight}}
</view>
<view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
{{page.qssl}}斤起订</view>
<view style="display: flex;flex-direction: row;align-items: center;" @click="showPop()">
<text
style="color: #6190D8;font-size: 13px;height: 10px;line-height: 10px;margin-top: 5px;text-decoration:underline;font-style:oblique;">
起订说明</text>
<text
style="color: #6190D8;font-size: 13px;height: 10px;line-height: 10px;margin-top: 5px;margin-left: 2px;">
>></text>
</view>
</view>
<view
style=" width: 100%; box-sizing: border-box; padding-left: 50px;padding-right: 50px;
display: flex;flex-direction: row; justify-content: center;align-items: center;margin-top: 10px;margin-bottom: 20px;">
<view
style="border: 1px #FF5006 solid;margin-left: 5px;margin-right: 5px;padding: 0px 5px;height: 42px; flex: 1;
display: flex;flex-direction: row;align-items: center;border-top-left-radius: 25px; border-bottom-left-radius: 25px;">
<image src="../../static/shoppCart_icon.png" mode="aspectFill"
style="height: 20px;width: 20px;flex-shrink: 0;margin-left: 10px;">
</image>
<view style="display: flex;flex-direction: column;flex: 1;">
<text style="font-size: 15px;color: #FF5006;margin-left: 10px; ">{{page.price}}</text>
<text style="font-size: 10px;color: #666;margin-left: 10px; ">{{page.remarks}}</text>
</view>
</view>
<text style="background: #FF9900; color: #fff;font-size: 13px; padding: 0px 25px;height: 40px;line-height: 40px;
border: 1px #FF5006 solid; border-top-right-radius: 25px; border-bottom-right-radius: 25px;"
@click="settlement()">结算</text>
</view>
</view>
</loading-state>
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="base" title="起订说明" :showConfirm="true"
:beforeClose="dialogBeforeClose" @confirm="dialogInputConfirm" :content="page.qdxy"></uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
notData: false,
dialogBeforeClose: false,
page: {
affiliation: '',
weight: "0",
price: "0",
reduce: "0",
remarks: "",
qssl: "",
qdxy: ""
},
data: [
]
}
},
onLoad(options) {
this.page.affiliation = options.affiliation
this.page.qssl = options.weight
this.page.qdxy = options.qdxy
console.log(" options", options);
},
onShow() {
this.request()
},
methods: {
gotoShopp() {
uni.reLaunch({
url: "/pages/home/cloudCard2"
})
},
showPop() {
this.$refs.inputDialog.open()
},
dialogInputConfirm() {
this.dialogBeforeClose = false
},
request() {
let _this = this
var params = {
customerSid: getApp().globalData.sid,
brandId: _this.page.affiliation
}
_this.$api.shoppingCartList(params).then((resp) => {
console.log("resp", resp);
_this.data = resp
_this.notData = resp.length == 0
// _this.getallPrice()
// _this.getweight()
_this.getAllPriceOrWeight()
}).catch(e => {
// 错误 1
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
},
itemClick(goodsSid) {
uni.navigateTo({
url: '/pages/good/goodsDetail?sid=' + goodsSid
})
},
jian(item) {
const that = this
console.log("item》》》》", item)
// if (Number(item.goodsNumber) == 1) {
// wx.showModal({
// content: '确定不要了吗',
// cancelText: "再想想",
// confirmText: "删除",
// confirmColor: "#FF9900",
// success(res) {
// if (res.confirm) {
// console.log('用户点击确定')
// item.goodsNumber = 0
// const index = that.data.findIndex((info) => info.goodsSid === item.goodsSid)
// console.log("index》》》》", index)
// that.data.splice(index, 1)
// // that.getallPrice()
// // that.getweight()
// that.notData = that.data.length == 0
// that.upDateShoppCart(item)
// } else if (res.cancel) {
// }
// }
// })
// } else {
if (Number(item.goodsNumber) > 0) {
item.goodsNumber = Number(item.goodsNumber) - 1
if (Number(item.goodsNumber) == 0) {
const index = that.data.findIndex((info) => info.goodsSid === item.goodsSid)
console.log("index》》》》", index)
that.data.splice(index, 1)
that.notData = that.data.length == 0
}
}
item.totalPrice = Number(item.goodsNumber) * Number(item.price)
// that.getallPrice()
// that.getweight()
that.upDateShoppCart(item)
// }
},
jia(item) {
item.goodsNumber = Number(item.goodsNumber) + 1
item.totalPrice = Number(item.goodsNumber) * Number(item.price)
// this.getallPrice()
// this.getweight()
this.upDateShoppCart(item)
},
getAllPriceOrWeight() {
let _this = this
var params = {
customerSid: getApp().globalData.sid,
brandId: this.page.affiliation,
}
_this.$api.getGoodsWeight(params).then((resp) => {
console.log("getGoodsWeight", resp);
_this.page.price = resp.totalPrice
_this.page.weight = resp.totalWeight
_this.page.remarks = resp.remarks
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(2)
})
}).catch(e => {
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
},
getallPrice() {
let num = 0;
for (var i = 0; i < this.data.length; i++) {
num += Number(this.data[i].totalPrice);
}
this.page.price = num
},
getweight() {
let num = 0;
for (var i = 0; i < this.data.length; i++) {
num += Number(this.data[i].weight) * Number(this.data[i].goodsNumber);
}
this.page.weight = num
},
upDateShoppCart(item) {
var good = {
goodsSid: item.goodsSid,
goodsName: item.goodsName,
goodsNumber: item.goodsNumber,
affiliation: this.page.affiliation,
price: item.price,
weight: item.weight,
customerSid: getApp().globalData.sid
}
let _this = this
_this.$api.addShoppingCart(good).then((resp) => {
_this.getAllPriceOrWeight()
}).catch(e => {
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
},
settlement() {
// 支付
if (this.page.weight < parseInt(this.page.qssl)) {
this.shortToast('满' + this.page.qssl + '斤才可定制云菜窖哦,请继续选菜吧。')
return
}
var params = {
customerSid: getApp().globalData.sid,
// cardNumber: 1,
brandId: this.page.affiliation,
totalTee: this.page.price,
// ordOrderDetailsVoList: list
}
console.log("params", params);
let _this = this
_this.$api.createVegeOrder(params).then((resp) => {
// console.log("resp", resp);
this.$pay(resp)
}).catch(e => {})
},
}
}
</script>
<style>
</style>

272
pages/good/transfer.vue Normal file
View File

@@ -0,0 +1,272 @@
<template>
<view style="width: 100%;height: 100%;background: #60CA2C;display: flex;flex-direction: column;">
<!-- <NavBar ref="nav" navTitle="转赠亲友" :showIcon="true" :supportChange="false">
</NavBar> -->
<view
style="display: flex;flex-direction: column;background: #f7f7f7;padding: 10px;border-radius: 15px; height: 100vh;width: 100%; box-sizing: border-box;">
<scroll-view scroll-y="true" style="height: calc(100vh - 150px); width: 100%; background: #fff;padding: 10px; box-sizing: border-box;
" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
<view style="display: flex;flex-direction: column;">
<view v-for="(item,index) in pickingUpGoods"
style=" display: flex;flex-direction: row;margin-top: 15px; margin-bottom: 10px;">
<view style="display: flex;flex-direction: row;align-items: center;width: 100%; ">
<image :src="item.iconUrl" style="width: 90px;height: 90px; border-radius: 10px; "
mode="aspectFill" @click="itemClick(item.goodsSid)"></image>
<view
style="display: flex;flex-direction: column;flex: 1; padding-bottom: 15px; margin-left: 10px;"
:style="{'border-bottom':(index == goods.length-1 ? 'none' : '1px #EFEFEF solid')}">
<text style="font-size: 14px;color: #000; font-weight: 600;"
@click="itemClick(item.goodsSid)">{{item.name}}</text>
<text style="font-size: 10px;color: #999;margin-top: 5px;">{{item.remark}}</text>
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 8px;">
<text style="border: 1px #EE752F solid; border-radius: 5px; padding: 0px 8px;
font-size: 10px;color: #EE752F;">{{item.weight}}{{item.specificationUnit}}/{{item.unitName}}</text>
<text
style="border: 1px #EE752F solid; background: #FF9900;margin-left: 10px; color: #fff; font-size: 10px;border-radius: 5px; padding: 0px 8px;"
v-if="item.type=='0'">百姓菜!</text>
<text
style="border: 1px #3AA15F solid; background: #40C772;margin-left: 10px; color: #fff; font-size: 10px;border-radius: 5px; padding: 0px 8px;"
v-if="item.type=='1'">精品菜!</text>
<text
style="border: 1px #1D60C7 solid; background: #2489F7;margin-left: 10px; color: #fff; font-size: 10px;border-radius: 5px; padding: 0px 8px;"
v-if="item.type=='2'">企业菜!</text>
</view>
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between; margin-top: 15px;
margin-right: 15px;">
<view style="display: flex;flex-direction: row;align-items: center;">
<text style="font-size: 10px;color: #FF5006;">存量</text>
<text
style="font-size: 14px;color: #FF5006;">{{item.goodsNumber}}{{item.unitName}}</text>
</view>
<view style="display: flex;flex-direction: row;align-items: center;">
<image src="../../static/jian_icon.png" mode="aspectFill"
style="width: 20px;height: 20px;" @click.stop="jian(item)"></image>
<text
style="font-size: 14px;margin-left: 8px;margin-right: 8px;">{{item.count}}</text>
<image src="../../static/jia_icon.png" mode="aspectFill"
style="width: 20px;height: 20px;" @click.stop="jia(item)"></image>
</view>
</view>
</view>
</view>
</view>
<view v-if="transferNotData"
style="display: flex;flex-direction: column;justify-content: center;align-items: center;margin-top: 5vw;">
<image src="https://supervise.yxtsoft.com/lpk/image/supplementing.png" mode="aspectFit"
style="width: 50vw;height: 50vw;"></image>
<view style="display: flex;flex-direction: row;align-items: center;margin-top: -15px;">
<text style=" border-radius: 8px; padding: 3px 8px; color: #999;">没有商品咯,请添加~</text>
</view>
</view>
</view>
</scroll-view>
</view>
<view style="position: fixed;bottom: 0;display: flex;flex-direction: column;
border-top: 1px solid #f7f7f7;
justify-content: center;background: #fff; width: 100%;box-sizing:border-box;">
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 15px;
padding-left: 15px;padding-right: 15px;">
<text style="font-size: 14px;margin-right: 10px;font-weight: 600;">转赠留言</text>
<input placeholder="可以写下您对亲友的祝福"
style="font-size: 30rpx;flex: 1;background: #F2F2F2;border-radius: 5px;height: 40px;line-height: 40px;padding-left: 10px;padding-right: 10px;"
:value="transferInfo.remarks" @input="onKeyInput" />
</view>
<button open-type="share" :disabled="transferNotData">确认</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
affiliation: "",
transferNotData: false,
transferInfo: {
},
pickingUpGoods: [],
}
},
onLoad(options) {
this.pickingUpGoods = JSON.parse(decodeURIComponent(options.pickingUpGoods))
this.affiliation = options.affiliation
console.log(">>>>>", options);
console.log(">>>>>", this.pickingUpGoods);
console.log(">>>>>", this.affiliation);
},
onPageScroll(res) {
// 渐变
this.$refs.nav.defaultColorBgAlpha(res)
},
methods: {
itemClick(goodsSid) {
uni.navigateTo({
url: '/pages/good/goodsDetail?sid=' + goodsSid
})
},
onKeyInput(event) {
this.transferInfo.remarks = event.target.value
},
jian(item) {
console.log("item》》》》", item)
const that = this
if (Number(item.count) == 1) {
wx.showModal({
content: '确定不要了吗',
cancelText: "再想想",
confirmText: "删除",
confirmColor: "#FF9900",
success(res) {
if (res.confirm) {
console.log('用户点击确定')
item.count = 0
const index = that.pickingUpGoods.findIndex((info) => info.goodsSid === item
.goodsSid)
console.log("index》》》》", index)
that.pickingUpGoods.splice(index, 1)
that.transferNotData = that.pickingUpGoods.length == 0
} else if (res.cancel) {
}
}
})
} else {
if (Number(item.count) > 0) {
item.count = Number(item.count) - 1
}
}
},
jia(item) {
if (item.count < item.goodsNumber)
item.count = Number(item.count) + 1
},
onShareAppMessage: function(res) {
let _this = this
const promise = new Promise(resolve => {
// 模拟网络请求
setTimeout(() => {
var list = []
for (var i = 0; i < this.pickingUpGoods.length; i++) {
var item = this.pickingUpGoods[i]
if (item.count > 0) {
list.push({
goodsSid: item.goodsSid,
select: item.count
})
}
}
var params = {
customerSid: getApp().globalData.sid,
brandId: _this.affiliation,
remarks: _this.transferInfo.remarks,
vos: list
}
// console.log("=========0", params);
_this.$api.transSubmission(params).then((resp) => {
uni.navigateBack()
// console.log("=========", resp);
let shareData = JSON.stringify({
params: {
code: resp.transferCode,
codeKey: resp.sid
},
functionName: 'bindCard',
url: '/pages/bind/bind_cloudCard?code=' + resp
.transferCode + "&codeKey=" + resp.sid
// url: '/pages/home/cloudCard2?shareSid=' + getApp().globalData.sid,
// functionName: 'share'
})
// 转码传输
let value = encodeURIComponent(shareData)
resolve({
title: '汇融农链-云菜窖',
// ②
path: '/pages/login/login?data=' + value,
imageUrl: 'https://supervise.yxtsoft.com/lpk/image/share_transfer.png', //自定义图片路径,显示图片长宽比是 5:4。
})
}).catch(e => {
_this.shortToast('发生错误,请稍后再试.')
return
})
}, 0)
})
return promise
},
}
}
</script>
<style>
button {
background: #60CA2C;
color: #fff;
margin-top: 20px;
height: 40px;
width: 80%;
line-height: 40px;
text-align: center;
border-radius: 20px;
margin-bottom: 20px;
}
</style>