jiazhipeng 4 months ago
parent
commit
b1e149d474
  1. 20
      package.json
  2. 10
      subPackages/food/detail.vue
  3. 2
      subPackages/food/index.vue
  4. 66
      subPackages/food/order.vue
  5. 64
      subPackages/techan/detail.vue
  6. 3
      subPackages/ticket/detail.vue
  7. 2
      subPackages/ticket/index.vue
  8. 28
      subPackages/ticket/order.vue

20
package.json

@ -0,0 +1,20 @@
{
"name": "flavoroftimesz",
"version": "1.0.0",
"description": "",
"main": "main.js",
"dependencies": {
"ydui-district": "^1.1.0",
"mobile-calendar-simple": "^2.4.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "http://123.60.98.226:3000/chenkainan/flavorOfTimeSz.git"
},
"author": "",
"license": "ISC"
}

10
subPackages/food/detail.vue

@ -148,6 +148,7 @@
export default { export default {
data() { data() {
return { return {
headImg: null, headImg: null,
id: null, id: null,
info: null, info: null,
@ -166,8 +167,6 @@
selectGoods: {}, // selectGoods: {}, //
cartNum: 0, cartNum: 0,
} }
}, },
onShow(options) { onShow(options) {
@ -194,7 +193,6 @@
this.down = true this.down = true
query.selectAll(".info-box-query").boundingClientRect(res=>{ query.selectAll(".info-box-query").boundingClientRect(res=>{
let i = res.findLastIndex(v=>v.top-100<=0) let i = res.findLastIndex(v=>v.top-100<=0)
console.log(res, i)
if (i>=0) { if (i>=0) {
this.type = i+1 this.type = i+1
} }
@ -281,11 +279,12 @@
addToCart () { addToCart () {
let goods = this.sku[this.productIndex] let goods = this.sku[this.productIndex]
goods.buyNum = this.buyNum goods.buyNum = this.buyNum
this.Post({sku_id: goods.id,num: this.buyNum },'api/cart/add_sku').then(res => { this.Post({sku_id: goods.id,num: this.buyNum },'/api/cart/add_sku').then(res => {
if (res.code == 1) { if (res.code == 1) {
uni.$emit("updateDataByConnect", {msgType:'updateCartDataInfo',data:null}) // uni.$emit("updateDataByConnect", {msgType:'updateCartDataInfo',data:null})
this.closePopup() this.closePopup()
// this.$refs.cartDataVueRef.openPop() // this.$refs.cartDataVueRef.openPop()
this.getCartList()
} }
}); });
@ -344,7 +343,6 @@
query.select('#box'+index).boundingClientRect(); //toViewid query.select('#box'+index).boundingClientRect(); //toViewid
query.selectViewport().scrollOffset(); // query.selectViewport().scrollOffset(); //
query.exec(function (res) { query.exec(function (res) {
console.log(res)
let scrollTop = res[0].top + res[1].scrollTop; let scrollTop = res[0].top + res[1].scrollTop;
uni.pageScrollTo({ uni.pageScrollTo({
scrollTop: scrollTop-50, scrollTop: scrollTop-50,

2
subPackages/food/index.vue

@ -42,7 +42,7 @@
this.finished = false this.finished = false
}, },
onReady() { onReady() {
this.getHeadImg(2366).then(res => {this.headImg = res}) this.getHeadImg(2372).then(res => {this.headImg = res})
this.getList() this.getList()
}, },
onLoad(options) { onLoad(options) {

66
subPackages/food/order.vue

@ -38,15 +38,15 @@
</view> </view>
<!-- 优惠券 --> <!-- 优惠券 -->
<view @click="goOrderCoupon" class="tickets-container flex-between top-line"> <view @click="goOrderCoupon" class="tickets-container flex-between top-line" v-if="!isShoppingCart">
<view class="order-title">优惠券</view> <view class="order-title">优惠券</view>
<view class="coupon-btn" v-if="coupon==''"> <view class="coupon-btn" v-if="coupon==''">
<view class="select">选择优惠券</view> <view class="select">选择优惠券</view>
<uni-icons style="height: 42rpx;" color="#999999" type="right" size="18"></uni-icons> <uni-icons style="height: 42rpx;" color="#999999" type="right" size="18"></uni-icons>
</view> </view>
<div class="coupon-price" v-else> <div class="coupon-price" v-else>
<span v-if="coupon.percent == 0">-{{coupon.discounts/100}}</span> <span v-if="coupon.activity.fold == 0">-{{coupon.activity.money/100}}</span>
<span v-else>-{{coupon.percent}}%</span> <span v-else>-{{coupon.activity.fold*10}}%</span>
<span style="margin:0 31rpx 0 8rpx;color: #6C7A94;">></span> <span style="margin:0 31rpx 0 8rpx;color: #6C7A94;">></span>
</div> </div>
</view> </view>
@ -86,6 +86,7 @@
components: {}, components: {},
data() { data() {
return { return {
isShoppingCart: false,
// //
orderList: [], orderList: [],
phone: '', phone: '',
@ -95,23 +96,28 @@
} }
}, },
onLoad(options) { onLoad(options) {
if (options.isShoppingCart) {
this.isShoppingCart = options.isShoppingCart
}
// this.getList(); // this.getList();
this.$store.commit("choseCoupon", ""); this.$store.commit("choseCoupon", "");
this.initPageData() this.initPageData()
}, },
onShow() { onShow() {
if (!this.isShoppingCart) {
this.coupon = this.$store.state.user.coupon this.coupon = this.$store.state.user.coupon
}
}, },
methods: { methods: {
goOrderCoupon () { goOrderCoupon () {
let allPrice = 0 let allPrice = 0
let skuIds= [] let skuIds= []
this.pInfo.specifications.forEach(v=>{ this.orderList.forEach(v=>{
allPrice+= v.price*v.buyNum allPrice+= v.sInfo.price*v.sInfo.buyNum
if (v.buyNum>0) { if (v.sInfo.buyNum>0) {
skuIds.push(v.id) skuIds.push(v.sInfo.id)
} }
}) })
uni.navigateTo({ uni.navigateTo({
@ -121,17 +127,26 @@
// //
async getMaxCouponData () { async getMaxCouponData () {
//
if (this.isShoppingCart) {
return
}
let allPrice = 0 let allPrice = 0
this.pInfo.specifications.forEach(v=>{ let skuIds= []
allPrice+= v.price*v.buyNum this.orderList.forEach(v=>{
allPrice+= v.sInfo.price*v.sInfo.buyNum
if (v.sInfo.buyNum>0) {
skuIds.push(v.sInfo.id)
}
}) })
let param = {money:allPrice,sku_ids:this.sInfo.id} let param = {sku_ids: skuIds.join(','), money: allPrice}
let res = await this.getMaxCoupon(param) let res = await this.getMaxCoupon(param)
if (res.id) { if (res.id) {
this.coupon = res this.coupon = res
} }
}, },
initPageData () { initPageData () {
let data = uni.getStorageSync('foodOrder'); let data = uni.getStorageSync('foodOrder');
try{ try{
@ -142,7 +157,7 @@
} catch(e){ } catch(e){
console.log(e) console.log(e)
} }
// this.getMaxCouponData() this.getMaxCouponData()
}, },
clearTel () {this.phone = ''}, clearTel () {this.phone = ''},
@ -173,15 +188,15 @@
}) })
this.allprice = allPrice this.allprice = allPrice
if (this.coupon) { if (this.coupon) {
if (this.coupon.percent == 0) { if (this.coupon.activity.fold == 0) {
if (this.coupon.discounts>allPrice) { if (this.coupon.activity.money>allPrice) {
price =0 price =0
}else{ }else{
price = allPrice - (this.coupon.discounts) price = allPrice - (this.coupon.activity.money)
} }
} else{ } else{
price = allPrice - allPrice * (this.coupon.percent/100) price = allPrice - allPrice * (this.coupon.activity.fold*10/100)
} }
} else { } else {
price = allPrice price = allPrice
@ -212,24 +227,21 @@
let canSubmit = true let canSubmit = true
this.orderList.filter(v=>v.sInfo.buyNum>0).forEach(item=>{ this.orderList.filter(v=>v.sInfo.buyNum>0).forEach(item=>{
let sku = item.sInfo let sku = item.sInfo
let use_date = item.allSeldDate[item.seldDateIndex].date
let start_time =(item.timesArr[item.seldTimeIndex]||{}).start_time
let end_time = (item.timesArr[item.seldTimeIndex]||{}).end_time
let param = { let param = {
specifications_id: sku.id, type: item.pInfo.type,
num: sku.buyNum, product_id: item.pInfo.id,
date: use_date, sku_id: sku.id,
start_time: start_time||'', product_num: sku.buyNum,
end_time: end_time||'', remark: sku.remark,
reserve_mobile: this.phone, phone: this.phone,
} }
goods.push(param) goods.push(param)
}) })
let data = { let data = {
goods: goods, product_list: goods,
coupon: this.coupon ? this.coupon.id : "", coupon_id: this.coupon ? this.coupon.id : "",
} }
console.log('data数据',data); console.log('data数据',data);
this.Post({ this.Post({
@ -237,7 +249,7 @@
data: JSON.stringify(data) data: JSON.stringify(data)
}, '/api/order/create').then(res => { }, '/api/order/create').then(res => {
if (res.code == 1) { if (res.code == 1) {
uni.removeStorageSync('ticketOrder')
console.log(res.data.order_id); console.log(res.data.order_id);
let order_id = res.data.order_id let order_id = res.data.order_id
this.$store.commit("choseCoupon", ""); this.$store.commit("choseCoupon", "");

64
subPackages/techan/detail.vue

@ -82,10 +82,10 @@
<uni-popup ref="popup" type="bottom" @change="changPopShow" style="position: relative;z-index: 50;"> <uni-popup ref="popup" type="bottom" @change="changPopShow" style="position: relative;z-index: 50;">
<view class="popup-content" v-if="sku.length>0"> <view class="popup-content" v-if="sku.length>0">
<view style="padding: 0rpx 39rpx 50rpx 39rpx;">
<view @click="closePopup" style="padding: 31rpx 0 0 639rpx;width: 50rpx;height: 80rpx;"> <view @click="closePopup" style="padding: 31rpx 0 0 639rpx;width: 50rpx;height: 80rpx;">
<uni-icons type="closeempty" size="24"></uni-icons> <uni-icons type="closeempty" size="24"></uni-icons>
</view> </view>
<view class="bottom-productImg"> <view class="bottom-productImg">
<img :src="showImg(sku[productIndex].headimg)" alt=""> <img :src="showImg(sku[productIndex].headimg)" alt="">
<view class="right-content"> <view class="right-content">
@ -94,10 +94,8 @@
</view> </view>
</view> </view>
<view> <view>
<view class="sp"> <view class="sp">规格</view>
规格 <view class="sp-container" style="">
</view>
<view style="display: flex;align-items: center;justify-content: space-between;flex-wrap: wrap;">
<view style="position:relative;" v-for="(botItem,botIndex) in sku" :key="botIndex"> <view style="position:relative;" v-for="(botItem,botIndex) in sku" :key="botIndex">
<view :class="['botProduct','text-overflow',{'noStore':botItem.store==0},{'botProducts':productIndex==botIndex}]" <view :class="['botProduct','text-overflow',{'noStore':botItem.store==0},{'botProducts':productIndex==botIndex}]"
@click="changeProduct(botItem,botIndex)"> @click="changeProduct(botItem,botIndex)">
@ -107,7 +105,6 @@
不可购买 不可购买
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="buy-num com-flex-tao"> <view class="buy-num com-flex-tao">
@ -123,12 +120,10 @@
</view> </view>
</view> </view>
</view> </view>
<view style="height: 40rpx;"></view> <view class="sp-bottom-btn">
<!-- <view class="btn-box"> <view class="btn" @click="openPop">{{addCart?"加入购物车":"立即购买"}}</view>
<view class="buy-btn" @click="order"> </view>
下一步
</view> </view>
</view> -->
</uni-popup> </uni-popup>
</view> </view>
</template> </template>
@ -154,6 +149,7 @@
showLength: 0, showLength: 0,
buyNum: 1, buyNum: 1,
popShow: false, popShow: false,
addCart: false,
cartNum: 0, cartNum: 0,
@ -228,9 +224,10 @@
} }
if (!this.popShow) { if (!this.popShow) {
this.addCart = flag
this.$refs.popup.open() this.$refs.popup.open()
} else { } else {
if (flag) { if (this.addCart) {
this.addToCart() this.addToCart()
} else { } else {
this.order() this.order()
@ -595,12 +592,13 @@
.popup-content { .popup-content {
background-color: white; background-color: white;
padding: 0rpx 39rpx 51rpx 39rpx;
height: auto; height: auto;
border-radius: 20rpx 20rpx 0 0; border-radius: 20rpx 20rpx 0 0;
.bottom-productImg { .bottom-productImg {
display: flex; display: flex;
margin-bottom: 23rpx; margin-bottom: 23rpx;
flex-shrink: 0;
} }
.bottom-productImg img { .bottom-productImg img {
@ -612,6 +610,8 @@
.right-content { .right-content {
margin: 10rpx 0 0 41rpx; margin: 10rpx 0 0 41rpx;
flex: 1;
width: 1rpx;
} }
.bottom-productPrice { .bottom-productPrice {
@ -625,7 +625,7 @@
} }
.bottom-content { .bottom-content {
width: 331rpx; width: 100%;
font-size: 27rpx; font-size: 27rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 400; font-weight: 400;
@ -679,7 +679,6 @@
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 400; font-weight: 400;
color: #333333; color: #333333;
// border-top: 1rpx solid #CCCCCC;
padding: 39rpx 0; padding: 39rpx 0;
display: flex; display: flex;
align-items: center; align-items: center;
@ -727,6 +726,7 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.sp { .sp {
width: 100%; width: 100%;
height: 30rpx; height: 30rpx;
@ -736,13 +736,45 @@
color: #060001; color: #060001;
line-height: 30rpx; line-height: 30rpx;
border-top: solid 2rpx #ccc; border-top: solid 2rpx #ccc;
margin: 60rpx 0; margin: 32rpx 0 60rpx;
padding-top: 30rpx; padding-top: 30rpx;
} }
.sp-container{
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
max-height: 400rpx;
overflow-y: auto;
padding-top: 20rpx;
padding-right: 20rpx;
overflow-x: hidden;
}
.sp-bottom-btn{
width: 750rpx;
height: 151rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(6, 0, 1, 0.1);
display: flex;
align-items: center;
justify-content: center;
.btn{
width: 697rpx;
height: 73rpx;
background: #6A8A2D;
border-radius: 11rpx;
font-weight: bold;
font-size: 32rpx;
color: #FFFFFF;
text-align: center;
line-height: 73rpx;
}
}
} }
.btn-post{ .btn-post{
font-size: 31rpx; font-size: 31rpx;
font-family: PingFangSC; font-family: PingFangSC;

3
subPackages/ticket/detail.vue

@ -551,9 +551,10 @@
goods.buyNum = this.buyNum goods.buyNum = this.buyNum
this.Post({sku_id: goods.id,num: this.buyNum },'/api/cart/add_sku').then(res => { this.Post({sku_id: goods.id,num: this.buyNum },'/api/cart/add_sku').then(res => {
if (res.code == 1) { if (res.code == 1) {
uni.$emit("updateDataByConnect", {msgType:'updateCartDataInfo',data:null}) // uni.$emit("updateDataByConnect", {msgType:'updateCartDataInfo',data:null})
this.closeCartPopup() this.closeCartPopup()
// this.$refs.cartDataVueRef.openPop() // this.$refs.cartDataVueRef.openPop()
this.getCartList()
} }
}); });
}, },

2
subPackages/ticket/index.vue

@ -51,7 +51,7 @@
// this.getHeadImg('piaowu') // this.getHeadImg('piaowu')
}, },
onReady() { onReady() {
this.getHeadImg(2366).then(res => {this.headImg = res}) this.getHeadImg(2373).then(res => {this.headImg = res})
this.getList() this.getList()
}, },
onLoad(options) { onLoad(options) {

28
subPackages/ticket/order.vue

@ -59,8 +59,8 @@
<uni-icons style="height: 42rpx;" color="#999999" type="right" size="18"></uni-icons> <uni-icons style="height: 42rpx;" color="#999999" type="right" size="18"></uni-icons>
</view> </view>
<div class="coupon-price" v-else> <div class="coupon-price" v-else>
<span v-if="coupon.activity.percent == 0">-{{coupon.activity.discounts/100}}</span> <span v-if="coupon.activity.fold == 0">-{{coupon.activity.money/100}}</span>
<span v-else>-{{coupon.activity.percent}}%</span> <span v-else>-{{coupon.activity.fold*10}}%</span>
<span style="margin:0 31rpx 0 8rpx;color: #6C7A94;">></span> <span style="margin:0 31rpx 0 8rpx;color: #6C7A94;">></span>
</div> </div>
</view> </view>
@ -266,15 +266,15 @@
}) })
this.allprice = allPrice this.allprice = allPrice
if (this.coupon) { if (this.coupon) {
if (this.coupon.percent == 0) { if (this.coupon.activity.fold == 0) {
if (this.coupon.discounts>allPrice) { if (this.coupon.activity.money>allPrice) {
price =0 price =0
}else{ }else{
price = allPrice - (this.coupon.discounts) price = allPrice - (this.coupon.activity.money)
} }
} else{ } else{
price = allPrice - allPrice * (this.coupon.percent/100) price = allPrice - allPrice * (this.coupon.activity.fold*10/100)
} }
} else { } else {
price = allPrice price = allPrice
@ -407,20 +407,23 @@
let start_time =(item.timesArr[item.seldTimeIndex]||{}).start_time let start_time =(item.timesArr[item.seldTimeIndex]||{}).start_time
let end_time = (item.timesArr[item.seldTimeIndex]||{}).end_time let end_time = (item.timesArr[item.seldTimeIndex]||{}).end_time
let param = { let param = {
specifications_id: sku.id, type: item.pInfo.type,
num: sku.buyNum, product_id: item.pInfo.id,
date: use_date, sku_id: sku.id,
product_num: sku.buyNum,
use_date: use_date,
start_time: start_time||'', start_time: start_time||'',
end_time: end_time||'', end_time: end_time||'',
reserve_mobile: this.phone, phone: this.phone,
remark: item.remark,
} }
goods.push(param) goods.push(param)
}) })
let data = { let data = {
goods: goods, product_list: goods,
coupon: this.coupon ? this.coupon.id : "", coupon_id: this.coupon ? this.coupon.id : "",
} }
console.log('data数据',data); console.log('data数据',data);
this.Post({ this.Post({
@ -428,7 +431,6 @@
data: JSON.stringify(data) data: JSON.stringify(data)
}, '/api/order/create').then(res => { }, '/api/order/create').then(res => {
if (res.code == 1) { if (res.code == 1) {
uni.removeStorageSync('ticketOrder')
console.log(res.data.order_id); console.log(res.data.order_id);
let order_id = res.data.order_id let order_id = res.data.order_id
this.$store.commit("choseCoupon", ""); this.$store.commit("choseCoupon", "");

Loading…
Cancel
Save