jiazhipeng 4 months ago
parent
commit
b1e149d474
  1. 20
      package.json
  2. 10
      subPackages/food/detail.vue
  3. 2
      subPackages/food/index.vue
  4. 68
      subPackages/food/order.vue
  5. 66
      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 {
data() {
return {
headImg: null,
id: null,
info: null,
@ -166,8 +167,6 @@
selectGoods: {}, //
cartNum: 0,
}
},
onShow(options) {
@ -194,7 +193,6 @@
this.down = true
query.selectAll(".info-box-query").boundingClientRect(res=>{
let i = res.findLastIndex(v=>v.top-100<=0)
console.log(res, i)
if (i>=0) {
this.type = i+1
}
@ -281,11 +279,12 @@
addToCart () {
let goods = this.sku[this.productIndex]
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) {
uni.$emit("updateDataByConnect", {msgType:'updateCartDataInfo',data:null})
// uni.$emit("updateDataByConnect", {msgType:'updateCartDataInfo',data:null})
this.closePopup()
// this.$refs.cartDataVueRef.openPop()
this.getCartList()
}
});
@ -344,7 +343,6 @@
query.select('#box'+index).boundingClientRect(); //toViewid
query.selectViewport().scrollOffset(); //
query.exec(function (res) {
console.log(res)
let scrollTop = res[0].top + res[1].scrollTop;
uni.pageScrollTo({
scrollTop: scrollTop-50,

2
subPackages/food/index.vue

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

68
subPackages/food/order.vue

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

66
subPackages/techan/detail.vue

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

3
subPackages/ticket/detail.vue

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

2
subPackages/ticket/index.vue

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

28
subPackages/ticket/order.vue

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

Loading…
Cancel
Save