diff --git a/package.json b/package.json new file mode 100644 index 0000000..bc82c23 --- /dev/null +++ b/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" +} diff --git a/subPackages/food/detail.vue b/subPackages/food/detail.vue index dd3c73d..56a2e4a 100644 --- a/subPackages/food/detail.vue +++ b/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, diff --git a/subPackages/food/index.vue b/subPackages/food/index.vue index 2dbce99..27d5fcf 100644 --- a/subPackages/food/index.vue +++ b/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) { diff --git a/subPackages/food/order.vue b/subPackages/food/order.vue index b6fd587..4ce4c77 100644 --- a/subPackages/food/order.vue +++ b/subPackages/food/order.vue @@ -38,15 +38,15 @@ - + 优惠券 选择优惠券
- -¥{{coupon.discounts/100}} - -{{coupon.percent}}% + -¥{{coupon.activity.money/100}} + -{{coupon.activity.fold*10}}% >
@@ -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", ""); diff --git a/subPackages/techan/detail.vue b/subPackages/techan/detail.vue index b947878..0ef834d 100644 --- a/subPackages/techan/detail.vue +++ b/subPackages/techan/detail.vue @@ -82,10 +82,10 @@ + - @@ -94,10 +94,8 @@ - - 规格 - - + 规格 + @@ -107,7 +105,6 @@ 不可购买 - @@ -122,13 +119,11 @@ - - - + + {{addCart?"加入购物车":"立即购买"}} + +
@@ -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,12 +736,44 @@ 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; diff --git a/subPackages/ticket/detail.vue b/subPackages/ticket/detail.vue index 6773e79..cf5e608 100644 --- a/subPackages/ticket/detail.vue +++ b/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() } }); }, diff --git a/subPackages/ticket/index.vue b/subPackages/ticket/index.vue index 2db6f28..6dfdb38 100644 --- a/subPackages/ticket/index.vue +++ b/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) { diff --git a/subPackages/ticket/order.vue b/subPackages/ticket/order.vue index f2d5c2a..c05c810 100644 --- a/subPackages/ticket/order.vue +++ b/subPackages/ticket/order.vue @@ -59,8 +59,8 @@
- -¥{{coupon.activity.discounts/100}} - -{{coupon.activity.percent}}% + -¥{{coupon.activity.money/100}} + -{{coupon.activity.fold*10}}% >
@@ -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", "");