Commit 5e0566effd97d06718ca231da0d42fc3c70ee6a3

Authored by vking
1 parent 10e6e35d

taocan

... ... @@ -6,6 +6,8 @@ Component({
properties: {
order:Object,
hasTopStatus:Boolean,
foods_info:Object,//订单详情
order_info:Object,//订单详情
},
/**
... ...
<!--components/2.0/taocan/subject.wxml-->
<wxs src="../../../utils/util.wxs" module="util" />
<view class="view card padding-lr-lg padding-tb">
<view class="header view flex align-center">
<view class="view avatar margin-right-sm" style="background-image: url('{{order.seller.oooo}}')"></view>
<view class="view avatar margin-right-sm" style="background-image: url('{{order_info.seller_image}}?imageView2/2/w/320')"></view>
<view class="flex-treble">
<view class="txt-32-h text-cut" style="margin-bottom: 2rpx;">123</view>
<view class="txt-24-h text-gray text-cut">地址</view>
<view class="txt-32-h text-cut" style="margin-bottom: 2rpx;">{{order_info.sellername}}</view>
<view class="txt-24-h text-gray text-cut">{{order_info.real_address}}</view>
</view>
<view class="view txt-28-h text-blue" wx:if="{{hasTopStatus}}">以哈哈</view>
<view class="phone view" wx:else=""></view>
</view>
<view class="view flex solid-bottom" style="padding-bottom: 36rpx;padding-top: 36rpx;">
<view class="thumb margin-right-lg"></view>
<view class="thumb margin-right-lg" style="background-image: url('{{foods_info.main_url}}?imageView2/2/w/320')"></view>
<view class="flex flex-direction justify-between">
<view class="flex align-center">
<view class="bg-white label txt-20-h">套餐名称</view>
<view class="txt-28-h margin-left-lg">套餐名称</view>
<view class="txt-28-h margin-left-lg">{{foods_info.name}}</view>
</view>
<view class="flex align-center">
<view class="bg-white label txt-20-h">套餐数量</view>
<view class="txt-28-h margin-left-lg">套餐名称</view>
<view class="txt-28-h margin-left-lg">1</view>
</view>
<view class="flex align-center">
<view class="bg-white label txt-20-h">有效期限</view>
<view class="txt-28-h margin-left-lg">套餐名称</view>
<view class="txt-28-h margin-left-lg">{{util.unixtoTime(foods_info.eff_time_end,'YYYY-MM-DD')}}</view>
</view>
<view class="flex align-center">
<view class="bg-white label txt-20-h">套餐价格</view>
<view class="txt-28-h margin-left-lg">套餐名称</view>
<view class="txt-28-h margin-left-lg">¥{{foods_info.sale_price}}</view>
</view>
</view>
</view>
... ...
... ... @@ -9,7 +9,7 @@
.avatar{
width: 60rpx;
height: 60rpx;
border-radius: 50%;
}
.phone{
width: 28rpx;
... ...
... ... @@ -11,26 +11,29 @@ Page({
activityId:'',
packs:{},
},
activityId:'',
/**
* 生命周期函数--监听页面加载
* sid 商家id
* pid 套餐id
*/
onLoad: function (options) {
this.activityId=options.pid
App.Foodset.GetFoodsetList({sid:options.sid}).then(res=>{
let packs={}
res.data.some(r=>{
r['包间可用']=r.service.indexOf('包间可用');
r['包间可用']=r.service.indexOf('包间可用')>-1;
r['免预约']=r.service.indexOf('免预约')>-1;
r['随时退']=r.service.indexOf('随时退')>-1;
r.sid=this.data.sid
packs[r.id]=r
})
this.setData({
packs:packs,
activityId:options.pid,
activityId:this.activityId,
})
this.getActivityDetail()
})
},
/**
... ... @@ -82,11 +85,14 @@ Page({
},
touchTab(e){
this.activityId=util.attr(e,'id')
let obj={
activityId:util.attr(e,'id'),
activityId:this.activityId,
}
let index=util.attr(e,'index')
let length=this.data.packs.length;
let id=util.attr(e,'id')
let ps=Object.keys(this.data.packs)
let index=ps.indexOf(id)
let length=ps.length;
let current=0
if(index>length-3){
current=length-3;
... ... @@ -95,6 +101,7 @@ Page({
}
obj.current=current
this.setData(obj)
this.getActivityDetail();
},
swiperChange(e){
console.log(e)
... ... @@ -107,5 +114,42 @@ Page({
this.setData({
hasShowRule:!this.data.hasShowRule,
})
}
},
getActivityDetail(){
let packs=this.data.packs
if(!packs[this.activityId].operator){
App.Foodset.GetFoodsetDetail({fid:this.activityId}).then(res=>{
packs[this.activityId]={...packs[this.activityId],...res.data}
this.setData({
packs:packs,
})
})
}
},
createSale(){
let pack=this.data.packs[this.activityId]
App.PayOnline.JsApiPay({
pay_type:1,
fid:this.activityId,
sid:pack.sid,
}).then(res=>{
if(res.ret==200){
let order_id=res.data.order_id
res.data.timeStamp+=""
wx.requestPayment({
...res.data,
success:res=>{
util.toast('支付成功')
setTimeout(()=>{
wx.navigateTo({
url:'/pages/taocan/order?id='+order_id,
})
},1000)
},
})
}else{
util.toast(res.msg,'none')
}
})
},
})
\ No newline at end of file
... ...
<!--pages/taocan/index.wxml-->
<wxs src="../../utils/util.wxs" module="util" />
<nav hasHome>套餐详情</nav>
<swiper
display-multiple-items="3"
... ... @@ -10,7 +11,9 @@
<swiper-item
bindtap="touchTab" data-id="{{item.id}}" data-index="{{index}}"
class="swiper-item {{activityId==item.id?'active':''}} flex align-center">
<view class="txt-28-h">{{item.name}}</view>
<view class="txt-28-h text-cut" style="width: 220rpx;height: 50rpx;">
<text class="swiper-item-txt">{{item.name}}</text>
</view>
</swiper-item>
</block>
</swiper>
... ... @@ -24,7 +27,7 @@
<view class="txt-20-h" style="margin-bottom: 8rpx;">¥</view>
<view class="txt-28-h" style="margin-bottom: 4rpx;">{{packs[activityId].market_price}}</view>
</view>
<view class="view flex text-orange align-end margin-left-sm" >
<view class="view flex text-orange align-end margin-left-sm" wx:if="{{packs[activityId].discount>0}}" >
<view class="view tag" style="margin-bottom: 16rpx;"></view>
<view class="view margin-left-xs txt-24-h" style="margin-bottom: 10rpx;">{{packs[activityId].discount*10}}折</view>
</view>
... ... @@ -52,14 +55,14 @@
<view class="dot"></view>
<view class="txt-30-h text-bold">有效期</view>
</view>
<view class="text-df">123123</view>
<view class="text-df">{{util.unixtoTime(packs[activityId].eff_time_start,'YYYY.MM.DD')}}-{{util.unixtoTime(packs[activityId].eff_time_end,'YYYY.MM.DD HH:II')}}</view>
</view>
<view class="view padding block">
<view class="flex align-center margin-bottom-sm">
<view class="dot"></view>
<view class="txt-30-h text-bold">使用时间</view>
</view>
<view class="text-df">123123</view>
<view class="text-df">{{packs[activityId].use_time}}</view>
</view>
<view class="view padding block padding-bottom-sm">
<view class="flex align-center margin-bottom-sm">
... ... @@ -67,7 +70,7 @@
<view class="txt-30-h text-bold">使用规则</view>
</view>
<view class="text-df" wx:if="{{hasShowRule}}">
<text>123123</text>
<text style="line-height: 40rpx;">{{packs[activityId].use_notice}}</text>
</view>
<view class="flex justify-center align-center rule margin-top-sm margin-bottom-sm" bindtap="toggleRule">
<view class="txt-28-h">{{hasShowRule?'收起':'展开更多'}}</view>
... ... @@ -79,19 +82,19 @@
<view class="view bottom flex align-center justify-between padding-lr-xl">
<view class="view flex align-end margin-right">
<view class="text-orange txt-40-h" style="margin-bottom: 4rpx;">¥</view>
<view class="text-orange txt-52-h margin-right-sm text-bold">123</view>
<view class="text-orange txt-52-h margin-right-sm text-bold">{{packs[activityId].sale_price}}</view>
</view>
<view class="view flex flex-direction justify-center align-center">
<view class="view flex text-orange align-center" >
<view class="view flex flex-direction justify-center align-start">
<view class="view flex text-orange align-center" wx:if="{{packs[activityId].discount>0}}">
<view class="view tag"></view>
<view class="view margin-left-xs txt-24-h">8折</view>
<view class="view margin-left-xs txt-24-h">{{packs[activityId].discount*10}}折</view>
</view>
<view class="huaxian flex align-end">
<view class="txt-24-h" style="margin-bottom: 2rpx;">¥</view>
<view class="txt-32-h">123</view>
<view class="txt-32-h">{{packs[activityId].market_price}}</view>
</view>
</view>
<view class="flex flex-treble justify-end">
<view class="flex flex-treble justify-end" bindtap="createSale">
<view class="buyButton txt-36-h text-bold flex align-center justify-center bg-blue-blue">立即抢购</view>
</view>
</view>
... ...
/* pages/taocan/index.wxss */
@import "../../colorui/main.wxss";
.swiper-item{
.swiper-item-txt{
position: relative;
}
.swiper-item.active:after{
.swiper-item.active .swiper-item-txt:after{
position: absolute;
bottom: 4rpx;
bottom: -14rpx;
width: 60rpx;
height: 6rpx;
background: linear-gradient(90deg, #3BBFF5 0%, #57A0FF 100%);
border-radius: 3rpx;
content: "";
left:calc(50% - 60rpx);
left:calc(50% - 30rpx);
display: block;
z-index: 9;
}
.swiper-item.active .txt-28-h{
font-weight: bold;
... ...
// pages/taocan/detail.js
import util from '../../utils/util';
import App from '../../utils/api';
//账单状态 1=初始化 2=交易成功(待使用) 3=已使用 4=退款中 5=已退款 6=已过期 7=支付失败
const orderStatusStr={
1:{status:'未支付',info:''},
2:{status:'待使用',info:'感谢您的支持,请您按尽快来店就餐呦'},
3:{status:'已使用',info:'感谢您的支持,满意的话记得常来呦'},
4:{status:'退款中',info:''},
5:{status:'已退款',info:'钱款已原路退还,请在微信账单查看呦'},
6:{status:'已过期',info:'您可以随时申请退款呦'},
7:{status:'支付失败',info:''},
}
Page({
/**
* 页面的初始数据
*/
data: {
order_info:null,
foods_info:null,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.options=options
this.getOrderInfo();
},
/**
... ... @@ -62,5 +76,33 @@ Page({
*/
onShareAppMessage: function () {
}
},
toggleRule(){
this.setData({
hasShowRule:!this.data.hasShowRule,
})
},
getOrderInfo() {
App.Foodset.GetFoodOrdersDetail({
ufid: this.options.id,
}).then(async res=>{
let qrcode=''
if(true || res.data.order_info.status==2){
qrcode=util.http_build_query({
path:'pages/writeoff/setmeal',
//path:'pages/me/s_index',
param:JSON.stringify({
sid:res.data.order_info.sid,
oid:res.data.order_info.id
})
},util.cgi('App.System.GetWxLiteCodeScene'))
}
this.setData({
order_info:{...res.data.order_info,...res.data.seller_info},
order_tips:orderStatusStr[res.data.order_info.status],
foods_info:res.data.foods_info[0],
qrcode:qrcode,
})
})
},
})
\ No newline at end of file
... ...
<!--pages/taocan/detail.wxml-->
<wxs src="../../utils/util.wxs" module="util" />
<view class="view bg-blue-img"></view>
<nav backgroundColor="rgba(0,0,0,0)" color="#ffffff"></nav>
<view class="view padding-lr padding-bottom-lg" style="position: relative">
<view class="text-white txt-40-h text-bold margin-top-sm">已退款</view>
<view class="text-white txt-28-h text-bold margin-bottom-lg" style="margin-top: 6rpx;">钱款已原路退还,请在微信账单查看呦</view>
<subject order="{{order}}">
<view class="text-white txt-40-h text-bold margin-top-sm">{{order_tips.status}}</view>
<view class="text-white txt-28-h text-bold margin-bottom-lg" style="margin-top: 6rpx;">{{order_tips.info}}</view>
<subject foods_info="{{foods_info}}" order_info="{{order_info}}">
<view class="view flex flex-direction justify-center align-center margin-top-lg">
<view class="Medium txt-28-h">券码:1111 1111 1111</view>
<image src="{{false?'':'http://nosqn.colorcun.com/taocan/1%20%2813%29.png'}}" mode="heightFix" style="height: 340rpx;"></image>
<view class="Medium txt-28-h {{order_info.status==2?'':'overline'}}">券码:{{order_info.id}}</view>
<image src="{{qrcode?qrcode:'http://nosqn.colorcun.com/taocan/1%20%2813%29.png'}}" mode="heightFix" style="height: 340rpx;"></image>
</view>
</subject>
<navigator url="/pages/reserve/detail?id={{order.seller.id}}&activeTab=reserve">
<navigator url="/pages/reserve/detail?id={{order_info.sid}}&activeTab=reserve">
<view class="view card flex margin-tb-sm padding-lg justify-between">
<view class="view text-bold txt-32-h">您还可以预订包间</view>
<view class="view bg-blue-blue round" style="padding: 8rpx 20rpx;">订包间</view>
... ... @@ -23,14 +24,14 @@
<view class="dot"></view>
<view class="txt-30-h text-bold">有效期</view>
</view>
<view class="text-df">123123</view>
<view class="text-df">{{util.unixtoTime(foods_info.eff_time_start,'YYYY.MM.DD')}}-{{util.unixtoTime(foods_info.eff_time_end,'YYYY.MM.DD HH:II')}}</view>
</view>
<view class="view padding block">
<view class="flex align-center margin-bottom-sm">
<view class="dot"></view>
<view class="txt-30-h text-bold">使用时间</view>
</view>
<view class="text-df">123123</view>
<view class="text-df">{{foods_info.use_time}}</view>
</view>
<view class="view padding block padding-bottom-sm">
<view class="flex align-center margin-bottom-sm">
... ... @@ -38,7 +39,7 @@
<view class="txt-30-h text-bold">使用规则</view>
</view>
<view class="text-df" wx:if="{{hasShowRule}}">
<text>123123</text>
<text style="line-height: 40rpx;">{{foods_info.use_notice}}</text>
</view>
<view class="flex justify-center align-center rule margin-top-sm margin-bottom-sm" bindtap="toggleRule">
<view class="txt-28-h">{{hasShowRule?'收起':'展开更多'}}</view>
... ... @@ -53,13 +54,13 @@
</view>
<view class="view padding padding-lr-lg flex justify-between">
<view class="text-gray txt-28-h">商品总价</view>
<view class="txt-28-h">¥888.00</view>
<view class="txt-28-h">¥{{order_info.price}}</view>
</view>
<view class="view padding-bottom padding-lr-lg flex justify-between">
<view class="text-gray txt-28-h">实际付款</view>
<view class="txt-28-h">¥888.00</view>
<view class="txt-28-h">¥{{order_info.should_price}}</view>
</view>
<navigator url="/pages/taocan/orderHis?id={{order.id}}">
<navigator url="/pages/taocan/orderHis?id={{order_info.id}}">
<view class="view padding-bottom padding-lr-lg flex justify-between">
<view class="text-gray txt-28-h">交易快照</view>
<view class="view txt-28-h flex-treble flex align-center justify-end">
... ... @@ -70,15 +71,19 @@
</navigator>
<view class="view padding-bottom padding-lr-lg flex justify-between">
<view class="text-gray txt-28-h">订单编号</view>
<view class="txt-28-h">¥888.00</view>
<view class="txt-28-h">{{order_info.order_no}}</view>
</view>
<view class="view padding-bottom padding-lr-lg flex justify-between">
<view class="text-gray txt-28-h">下单时间</view>
<view class="txt-28-h">¥888.00</view>
<view class="txt-28-h">{{util.unixtoTime(order_info.pay_time,'YYYY-MM-DD HH:II:SS')}}</view>
</view>
<view class="view padding-bottom padding-lr-lg flex justify-between">
<view class="text-gray txt-28-h">使用时间</view>
<view class="txt-28-h">{{util.unixtoTime(order_info.use_time,'YYYY-MM-DD HH:II:SS')}}</view>
</view>
<view class="view padding-bottom padding-lr-lg flex justify-between">
<view class="text-gray txt-28-h">退款时间</view>
<view class="txt-28-h">¥888.00</view>
<view class="txt-28-h">{{util.unixtoTime(order_info.refund_time,'YYYY-MM-DD HH:II:SS')}}</view>
</view>
</view>
</view>
... ...
... ... @@ -28,4 +28,7 @@
}
.rule .icon.show{
background-image: url("http://nosqn.colorcun.com/taocan/1%20%286%29.png");
}
.overline{
text-decoration: line-through;
}
\ No newline at end of file
... ...
// pages/taocan/orderHis.js
import util from '../../utils/util';
import App from '../../utils/api';
Page({
/**
... ... @@ -12,7 +14,8 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.options=options
this.getOrderInfo();
},
/**
... ... @@ -67,5 +70,20 @@ Page({
this.setData({
hasShowRule:!this.data.hasShowRule,
})
}
},
getOrderInfo() {
App.Foodset.GetFoodOrdersDetail({
ufid: this.options.id,
}).then(async res=>{
let foods_info=res.data.foods_info[0]
foods_info['包间可用']=foods_info.service.indexOf('包间可用')>-1;
foods_info['免预约']=foods_info.service.indexOf('免预约')>-1;
foods_info['随时退']=foods_info.service.indexOf('随时退')>-1;
this.setData({
order_info:res.data.order_info,
//order_tips:orderStatusStr[res.data.order_info.status],
foods_info:foods_info,
})
})
},
})
\ No newline at end of file
... ...
<!--pages/taocan/orderHis.wxml-->
<nav hasHome>套餐详情</nav>
<wxs src="../../utils/util.wxs" module="util" />
<nav>套餐详情</nav>
<view class="text-orange txt-28-h padding-lr-lg tips">发生交易纠纷时,此页面可作为判断依据。</view>
<view class="view" style="padding-bottom: 150rpx;">
<view class="view box margin-lr margin-top-lg margin-bottom-sm padding">
<view class="view txt-40-h text-bold">招牌花开富贵六十人餐</view>
<view class="view txt-40-h text-bold">{{foods_info.name}}</view>
<view class="view flex align-end">
<view class="text-orange txt-28-h" style="margin-bottom: 4rpx;">¥</view>
<view class="text-orange txt-44-h margin-right-sm text-bold">123</view>
<view class="text-orange txt-44-h margin-right-sm text-bold">{{foods_info.sale_price}}</view>
<view class="huaxian flex align-end">
<view class="txt-20-h" style="margin-bottom: 8rpx;">¥</view>
<view class="txt-28-h" style="margin-bottom: 4rpx;">123</view>
<view class="txt-28-h" style="margin-bottom: 4rpx;">{{foods_info.market_price}}</view>
</view>
<view class="view flex text-orange align-end margin-left-sm" >
<view class="view flex text-orange align-end margin-left-sm" wx:if="{{foods_info.discount>0}}">
<view class="view tag" style="margin-bottom: 16rpx;"></view>
<view class="view margin-left-xs txt-24-h" style="margin-bottom: 10rpx;">8折</view>
<view class="view margin-left-xs txt-24-h" style="margin-bottom: 10rpx;">{{foods_info.discount*10}}折</view>
</view>
</view>
<view class="view flex align-center txt-28-h margin-bottom labels" style="margin-top: 10rpx;">
<view class="view margin-right flex align-center">
<view class="view margin-right flex align-center" wx:if="{{foods_info['包间可用']}}">
<view class="view icon icon1"></view>
<view class="view txt-28-h bg-white">包间可用</view>
</view>
<view class="view margin-right flex align-center">
<view class="view margin-right flex align-center" wx:if="{{foods_info['免预约']}}">
<view class="view icon icon2"></view>
<view class="view txt-28-h bg-white">免预约</view>
</view>
<view class="view margin-right flex align-center">
<view class="view margin-right flex align-center" wx:if="{{foods_info['随时退']}}">
<view class="view icon icon3"></view>
<view class="view txt-28-h bg-white">随时退</view>
</view>
</view>
<image src="" style="width:100%;background-color: #cccccc;border-radius: 10rpx;" mode="widthFix"></image>
<image src="{{foods_info.detail_url}}" style="width:100%;border-radius: 10rpx;" mode="widthFix"></image>
</view>
<view class="view box margin-lr margin-top-sm margin-bottom-sm">
<view class="txt-30-h padding solid-bottom">购买须知</view>
... ... @@ -39,14 +40,14 @@
<view class="dot"></view>
<view class="txt-30-h text-bold">有效期</view>
</view>
<view class="text-df">123123</view>
<view class="text-df">{{util.unixtoTime(foods_info.eff_time_start,'YYYY.MM.DD')}}-{{util.unixtoTime(foods_info.eff_time_end,'YYYY.MM.DD HH:II')}}</view>
</view>
<view class="view padding block">
<view class="flex align-center margin-bottom-sm">
<view class="dot"></view>
<view class="txt-30-h text-bold">使用时间</view>
</view>
<view class="text-df">123123</view>
<view class="text-df">{{foods_info.use_time}}</view>
</view>
<view class="view padding block padding-bottom-sm">
<view class="flex align-center margin-bottom-sm">
... ... @@ -54,7 +55,7 @@
<view class="txt-30-h text-bold">使用规则</view>
</view>
<view class="text-df" wx:if="{{hasShowRule}}">
<text>123123</text>
<text style="line-height: 40rpx;">{{foods_info.use_notice}}</text>
</view>
<view class="flex justify-center align-center rule margin-top-sm margin-bottom-sm" bindtap="toggleRule">
<view class="txt-28-h">{{hasShowRule?'收起':'展开更多'}}</view>
... ...
... ... @@ -730,13 +730,13 @@
{
"name": "pages/taocan/order",
"pathName": "pages/taocan/order",
"query": "id=1",
"query": "id=0000000011",
"scene": null
},
{
"name": "pages/taocan/orderHis",
"pathName": "pages/taocan/orderHis",
"query": "id=1",
"query": "id=0000000011",
"scene": null
}
]
... ...
... ... @@ -503,6 +503,13 @@ export default {
//获取商家菜品套餐详情
'App.Foodset.GetFoodsetDetail':null,
//JSAPI下单API【1=菜品套餐支付】
'App.PayOnline.JsApiPay':{
openid:'openid',
},
//根据账单ID获取账单详情
'App.Foodset.GetFoodOrdersDetail':null,
//获取商家优惠对接人信息
'App.Customer.GetSellerPreferentialDocking':null,
... ...