Browse Source

测试分账

test
Enzo 4 years ago
parent
commit
b9ac8b0b24
  1. 18
      App.vue
  2. 2
      common/http.js
  3. 2
      common/uploadFile.js
  4. 87
      components/zwy-calendar/zwy-calendar.vue
  5. 1
      main.js
  6. 2
      manifest.json
  7. 17
      pages/goodsDetail/index.vue
  8. 151
      pages/order/confirm_atonce.vue
  9. 84
      pages/order/confirm_order.vue
  10. 4
      uview-ui/components/u-column-notice/u-column-notice.vue
  11. 1
      uview-ui/components/u-notice-bar/u-notice-bar.vue

18
App.vue

@ -8,15 +8,29 @@
customBarH: 0, // customBarH: 0, //
windowHeight: 0, // - windowHeight: 0, // -
}, },
onLaunch: function() {
onLaunch: function(e) {
this.disableConsole(); this.disableConsole();
this.getSystemInfo(); this.getSystemInfo();
this.getUserInfo(); this.getUserInfo();
}, },
onShow: function() {
onShow(e) {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
this.getUpdateWexin(); // this.getUpdateWexin(); //
// #endif // #endif
setTimeout(() => {
if(e.referrerInfo.extraData) {
uni.$emit('payState',{msg:e.referrerInfo.extraData.backPayState})
uni.$emit('order_id',{msg:e.referrerInfo.extraData.order_id})
console.log('订单状态',e.referrerInfo.extraData.backPayState)
console.log('订单id',e.referrerInfo.extraData.order_id)
// uni.setStorageSync('order_id',e.referrerInfo.extraData.order_id)
// uni.setStorageSync('backPayState',e.referrerInfo.extraData.backPayState)
}
},500)
}, },
methods: { methods: {
// //

2
common/http.js

@ -93,7 +93,7 @@ function $http(url, data = {}, options = {}){
var accountInfo = wx.getAccountInfoSync(); var accountInfo = wx.getAccountInfoSync();
var autoappid = accountInfo.miniProgram.appId; var autoappid = accountInfo.miniProgram.appId;
options.appid = autoappid || 'wxeb58570b5e04d147'
options.appid = autoappid || 'wxb35ef055a4dd8ad4';
console.log('请求',options.appid) console.log('请求',options.appid)

2
common/uploadFile.js

@ -33,7 +33,7 @@ const uploadFile = function (filePath, successc, failc) {
var accountInfo = wx.getAccountInfoSync(); var accountInfo = wx.getAccountInfoSync();
var autoappid = accountInfo.miniProgram.appId; var autoappid = accountInfo.miniProgram.appId;
var uploadappid = autoappid || 'wxeb58570b5e04d147';
var uploadappid = autoappid || 'wxb35ef055a4dd8ad4';
console.log('上次',uploadappid) console.log('上次',uploadappid)

87
components/zwy-calendar/zwy-calendar.vue

@ -1,11 +1,16 @@
<template> <template>
<view class="calendar-box"> <view class="calendar-box">
<view class="month lf-p-l-10 lf-p-r-10">
<view @click="lastMonth" v-if="havePre">上月</view>
<view>{{year}}{{month}}</view>
<view @click="nextMonth" v-if="haveNext">下月</view>
</view>
<view class="week"> <view class="week">
<view :style="'color:'+(weeks==weeked?bgweek:'')+';'" v-for="weeks in weekArr">{{weeks}}</view>
<view v-for="weeks in weekArr">{{weeks}}</view>
</view> </view>
<view class="day"> <view class="day">
<view :class="[{'checkday':days.date==''},{'choose':days.date==localDate}]"
:style="'background:'+(days.date==localDate?bgday:'')+';'" v-for="(days,index) in dayArr" :key="index">
<view :class="[{'checkday':days.date==''},{'choose':days.flag==true}]"
:style="'background:'+(days.flag==true?bgday:'')+';'" v-for="(days,index) in dayArr" :key="index">
{{days.day}} {{days.day}}
<view :class="[{'circle':days.flag},{'repair':days.day<day},{'sign':days.day==day}]"></view> <view :class="[{'circle':days.flag},{'repair':days.day<day},{'sign':days.day==day}]"></view>
</view> </view>
@ -35,6 +40,14 @@
bgday: { bgday: {
type: String, type: String,
default: '#1998FE' default: '#1998FE'
},
startTime: {
type: String,
default: ''
},
endTime: {
type: String,
default: ''
} }
}, },
data() { data() {
@ -46,10 +59,17 @@
year: new Date().getFullYear(), // year: new Date().getFullYear(), //
month: new Date().getMonth() + 1, // month: new Date().getMonth() + 1, //
weekArr: ['日', '一', '二', '三', '四', '五', '六'], // weekArr: ['日', '一', '二', '三', '四', '五', '六'], //
selfDays: 0,
havePre: false,
haveNext: false
} }
},
onShow() {
}, },
mounted() { mounted() {
let that = this; let that = this;
that.dateDiff(that.startTime,that.endTime);
// //
that.initDate(); that.initDate();
// //
@ -61,7 +81,31 @@
// //
if (that.type != 'calendar') { if (that.type != 'calendar') {
for (let i in that.dayArr) { for (let i in that.dayArr) {
that.$set(that.dayArr[i], 'flag', false);
let chooseList = []
if(that.selfDays) {
var dataStart = that.startTime.split('-');
var endStart = that.endTime.split('-');
let numberStart = Number(dataStart[2])
let nowMonth = new Date().getMonth() + 1;
let splitStartMonth = dataStart[1];
let splitEndMonth = endStart[1];
console.log('当前月',nowMonth)
console.log('传来的月份',that.month)
if(that.month < nowMonth) {
console.log('小于当前月')
this.havePre = true
}else if(splitEndMonth > nowMonth){
console.log('大于当前月')
this.haveNext = true
}
var totalDays = Number(that.selfDays) + Number(dataStart[2]);
for(let j = numberStart;j < totalDays;j++) {
if(that.dayArr[i].day == j && that.dayArr[i].date) {
that.$set(that.dayArr[i], 'flag', true);
}
}
}
// that.$set(that.dayArr[i], 'flag', false);
} }
} }
}, },
@ -98,6 +142,39 @@
} }
} }
}, },
dateDiff(sDate1,sDate2) {
var aDate, oDate1, oDate2, iDays;
aDate = sDate1.split('-');
console.log('addate',aDate[1])
if(aDate[1] == '01') {
this.month = 1
}else if (aDate[1] == '02') {
this.month = 2
}else if (aDate[1] == '03') {
this.month = 3
}else if (aDate[1] == '04') {
this.month = 4
}else if (aDate[1] == '05') {
this.month = 5
}else if (aDate[1] == '06') {
this.month = 6
}else if (aDate[1] == '07') {
this.month = 7
}else if (aDate[1] == '08') {
this.month = 8
}else if (aDate[1] == '09') {
this.month = 9
}else{
this.month = Number(aDate[1])
}
if(aDate[1])
oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]);
aDate = sDate2.split('-');
oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]);
iDays = parseInt(Math.abs(oDate1 - oDate2) /1000/60/60/24);
this.selfDays = iDays+1;
return iDays + 1;
},
// //
initDate() { initDate() {
let that = this; let that = this;
@ -115,8 +192,6 @@
obj.date = that.year + '-' + that.formatNum(that.month) + '-' + that.formatNum(i); obj.date = that.year + '-' + that.formatNum(that.month) + '-' + that.formatNum(i);
obj.day = i; obj.day = i;
that.dayArr.push(obj); that.dayArr.push(obj);
//
console.log('当前越日期',that.dayArr)
if (i == totalDay && value != 6) that.addAfter(value); if (i == totalDay && value != 6) that.addAfter(value);
} }
}, },

1
main.js

@ -13,6 +13,7 @@ Vue.mixin(mixin);
// 将API注入全局 // 将API注入全局
Vue.prototype.API = API; Vue.prototype.API = API;
// 全局共享方法 // 全局共享方法
Vue.prototype.$shared = $shared; Vue.prototype.$shared = $shared;

2
manifest.json

@ -50,7 +50,7 @@
"quickapp" : {}, "quickapp" : {},
/* */ /* */
"mp-weixin" : { "mp-weixin" : {
"appid" : "wxeb58570b5e04d147",
"appid" : "wxb35ef055a4dd8ad4",
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : false,
"es6" : false, "es6" : false,

17
pages/goodsDetail/index.vue

@ -140,15 +140,15 @@
</view> </view>
</view> </view>
<view class="goods-detail"> <view class="goods-detail">
<view class="lf-m-b-20 lf-row-between">
<view class="lf-row-between">
<view class="lf-font-32 lf-font-bold"> <view class="lf-font-32 lf-font-bold">
行程时间 行程时间
</view> </view>
<view class="lf-font-28 lf-color-black "> <view class="lf-font-28 lf-color-black ">
<view>{{year}}{{month}}</view>
<view>{{goods_detail.product.extends.field_0.date.start}}~{{goods_detail.product.extends.field_0.date.end}}</view>
</view> </view>
</view> </view>
<zwyCalendar type="sign"/>
<!-- <zwyCalendar class="lf-m-t-20" type="sign" :startTime="'2021-10-01'" :endTime="'2021-11-01'"/> -->
</view> </view>
</view> </view>
@ -221,7 +221,6 @@
methods: { methods: {
// //
openMap(address,lat,lng){ openMap(address,lat,lng){
this.$msg('提示了')
// let { address, lat, lng } = this.goods_detail?.store || {}; // let { address, lat, lng } = this.goods_detail?.store || {};
uni.openLocation({ uni.openLocation({
longitude: Number(lng), longitude: Number(lng),
@ -270,16 +269,6 @@
phoneNumber: String(phoneStr) phoneNumber: String(phoneStr)
}) })
}, },
//
openMap(){
let { address, lat, lng } = this.goods_detail?.store || {};
uni.openLocation({
longitude: Number(lat),
latitude: Number(lng),
scale: 20,
name: address
});
},
// //
toAddOrder(){ toAddOrder(){
let goods_id = this.goods_detail.id; let goods_id = this.goods_detail.id;

151
pages/order/confirm_atonce.vue

@ -1,60 +1,84 @@
<template> <template>
<view>
</view>
<view></view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
order_id: 0
order_id: 0,
timesIndex: 0
} }
}, },
onLoad(e) {
this.order_id = e.order_id
console.log(this.order_id)
if(this.order_id) {
this.getUserProfile()
onShow(e) {
// this.order_id = uni.getStorageSync('order_id')
let that = this
uni.$on('order_id',function(data){
that.order_id = data.msg
if (that.order_id) {
that.getUserProfile()
} else { } else {
this.order_id = '1111111';
this.getUserProfile();
console.log('oder_id',this.order_id)
that.$msg('获取订单失败');
} }
})
}, },
methods: { methods: {
// //
getUserProfile() { getUserProfile() {
uni.getUserProfile({
desc: '您的信息将用于小程序显示',
lang: 'zh_CN',
let that = this
return new Promise((resolve, rejecj) => {
uni.login({
complete: result => { complete: result => {
console.log(result)
if(result.errMsg == 'getUserProfile:ok'){
let encryptedData = result.encryptedData;
let iv = result.iv;
let signature = result.signature;
// let userInfo = uni.getStorageSync('userinfo') || {};
this.$http(this.API.API_GETUSERINFO, {
encryptedData,
iv,
// token: userInfo.token //
if (result.errMsg == 'login:ok') {
let code = result.code;
that.$http(that.API.API_WXLOGIN, {
code
}).then(res => { }).then(res => {
console.log("更新用户信息", res);
this.$msg('更新成功', {icon: 'success'});
uni.setStorageSync('userinfo', res.data); uni.setStorageSync('userinfo', res.data);
this.payOnce()
setTimeout(() => {
this.$toBack();
}, 1000);
resolve(res.data);
if(res.data) {
that.payOnce();
}
// uni.showModal({
// title: '',
// content: JSON.stringify(res.data),
// confirmColor: '#1998FE',
// showCancel: false,
// success(res2) {
// if (res2.confirm) {
// that.payOnce();
// }
// }
// });
}) })
} }
} }
});
})
})
}, },
payOnce() { payOnce() {
this.$http(this.API.API_LF_PAY,{id: this.order_id}).then(res => {
let that = this
uni.showModal({
title: '订单id提示',
content: JSON.stringify(that.order_id),
showCancel: false,
});
that.$http(that.API.API_LF_PAY, {
id: that.order_id
}).then(res => {
uni.showModal({
title: '进入支付接口',
content: '',
showCancel: false,
});
uni.showModal({
title: '接口返回信息',
content: JSON.stringify(res),
showCancel: false,
});
uni.requestPayment({ uni.requestPayment({
orderInfo: res.data.order_num, orderInfo: res.data.order_num,
timeStamp: res.data.timeStamp, timeStamp: res.data.timeStamp,
@ -63,13 +87,65 @@
signType: res.data.signType, signType: res.data.signType,
paySign: res.data.paySign, paySign: res.data.paySign,
success: (res) => { success: (res) => {
this.$url('/pages/payState/paystate?ifSuccess=1&order_id='+this.order_id,{type: 'redirect'})
uni.showModal({
title: '支付成功提示',
content: JSON.stringify(res),
showCancel: false,
});
wx.navigateBackMiniProgram({
extraData: {
backPayState: true
},
success(res) {}
})
}, },
fail: (err) => { fail: (err) => {
this.$url('/pages/payState/paystate?ifSuccess=2&order_id='+this.order_id,{type: 'redirect'})
uni.showModal({
title: '支付失败提示',
content: JSON.stringify(err),
showCancel: false,
});
wx.navigateBackMiniProgram({
extraData: {
backPayState: false
}, },
success(res) {}
})
},
})
}).catch(err => {
uni.showModal({
title: '接口报错',
content: JSON.stringify(err),
showCancel: false,
success(res2) {
if (res2.confirm) {
wx.navigateBackMiniProgram({
extraData: {
backPayState: false
},
success(res) {}
})
}
}
});
// uni.showModal({
// title: '',
// content: '',
// confirmColor: '#1998FE',
// showCancel: false,
// success(res2) {
// if (res2.confirm) {
// wx.navigateBackMiniProgram({
// extraData: {
// backPayState: false
// },
// success(res) {}
// })
// }
// }
// });
}) })
}).catch(err => {})
} }
} }
} }
@ -87,6 +163,7 @@
font-size: 32rpx; font-size: 32rpx;
border-radius: 41rpx; border-radius: 41rpx;
} }
.bref-box { .bref-box {
text-overflow: -o-ellipsis-lastline; text-overflow: -o-ellipsis-lastline;
overflow: hidden; overflow: hidden;

84
pages/order/confirm_order.vue

@ -118,7 +118,8 @@
btn_type: 1, btn_type: 1,
ifPay: true, ifPay: true,
order_id: 0, order_id: 0,
enter_type: 0
enter_type: 0,
payState: true
} }
}, },
onLoad(e) { onLoad(e) {
@ -130,10 +131,41 @@
this.getGoodsData(this.pay_type); this.getGoodsData(this.pay_type);
} }
if(this.order_id && this.enter_type == 1) { if(this.order_id && this.enter_type == 1) {
console.log('立即付款')
this.payOnce();
this.$http(this.API.API_CREATEORDER,{id: this.goods_id,num: 1,pay_type: this.pay_type,name:this.contact,mobile:this.phone}).then(res => {
this.order_id = res.data.id
wx.navigateToMiniProgram({
appId: res.data.jump_appid,
path: '/pages/order/confirm_atonce',
envVersion: 'release',
extraData: {
order_id: res.data.id
},
success(res) {
console.log('---res---')
console.log(res)
},
fail(err) {
console.log('---err---')
console.log(err)
}
})
}).catch(err => {
})
} }
}, },
onShow(e) {
// this.backPayState = uni.getStorageSync('backPayState')
let that = this
uni.$on('payState',(data) => {
that.payState = data.msg
if(that.payState == true) {
that.$url('/pages/payState/paystate?ifSuccess=1&order_id='+that.order_id,{type: 'redirect'})
}else {
that.$url('/pages/payState/paystate?ifSuccess=2&order_id='+that.order_id,{type: 'redirect'})
}
})
},
methods: { methods: {
payStatus(type) { payStatus(type) {
if(type == this.pay_type) { if(type == this.pay_type) {
@ -160,14 +192,22 @@
return; return;
} }
if(this.goods_details.jump == true) {
let that = this;
var accountInfo = wx.getAccountInfoSync();
var autoappid = accountInfo.miniProgram.appId;
if(!this.ifPay) return;
this.ifPay = false;
this.$http(this.API.API_CREATEORDER,{id: this.goods_id,num: 1,pay_type: this.pay_type,name:this.contact,mobile:this.phone}).then(res => {
this.order_id = res.data.id
if(this.pay_type == 1) {
this.ifPay = true
this.$url('/pages/payState/paystate?ifSuccess=1&order_id='+this.order_id,{type: 'redirect'})
}else if(res.data.jump == true) {
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: autoappid,
path: '/pages/order/confirm_atonce?order_id=' + this.order_id,
appId: res.data.jump_appid,
path: '/pages/order/confirm_atonce',
envVersion: 'release', envVersion: 'release',
extraData: {
order_id: res.data.id
},
success(res) { success(res) {
console.log('---res---') console.log('---res---')
console.log(res) console.log(res)
@ -177,37 +217,11 @@
console.log(err) console.log(err)
} }
}) })
}else {
if(!this.ifPay) return;
this.ifPay = false;
this.$http(this.API.API_CREATEORDER,{id: this.goods_id,num: 1,pay_type: this.pay_type,name:this.contact,mobile:this.phone}).then(res => {
this.order_id = res.data.id
if(this.pay_type == 1) {
this.ifPay = true
this.$url('/pages/payState/paystate?ifSuccess=1&order_id='+this.order_id,{type: 'redirect'})
}else {
uni.requestPayment({
orderInfo: res.data.order_num,
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success: (res) => {
this.ifPay = true
this.$url('/pages/payState/paystate?ifSuccess=1&order_id='+this.order_id,{type: 'redirect'})
},
fail: (err) => {
this.ifPay = true
this.$url('/pages/payState/paystate?ifSuccess=2&order_id='+this.order_id,{type: 'redirect'})
},
})
} }
}).catch(err => { }).catch(err => {
this.ifPay = true this.ifPay = true
}) })
}
}, },
payOnce() { payOnce() {
this.$http(this.API.API_ORDERPAY,{id: this.order_id}).then(res => { this.$http(this.API.API_ORDERPAY,{id: this.order_id}).then(res => {

4
uview-ui/components/u-column-notice/u-column-notice.vue

@ -10,7 +10,8 @@
]" ]"
> >
<view class="u-icon-wrap"> <view class="u-icon-wrap">
<u-icon class="u-left-icon" v-if="volumeIcon" name="volume-fill" :size="volumeSize" :color="computeColor"></u-icon>
<text class="lf-iconfont lf-icon-tongzhi lf-text-vertical" style="color: #1998FE;"></text>
<!-- <u-icon class="u-left-icon" v-if="volumeIcon" name="volume-fill" :size="volumeSize" :color="computeColor"></u-icon> -->
</view> </view>
<swiper :disable-touch="disableTouch" @change="change" :autoplay="autoplay && playState == 'play'" :vertical="vertical" circular :interval="duration" class="u-swiper"> <swiper :disable-touch="disableTouch" @change="change" :autoplay="autoplay && playState == 'play'" :vertical="vertical" circular :interval="duration" class="u-swiper">
<swiper-item v-for="(item, index) in list" :key="index" class="u-swiper-item"> <swiper-item v-for="(item, index) in list" :key="index" class="u-swiper-item">
@ -200,6 +201,7 @@ export default {
flex-wrap: nowrap; flex-wrap: nowrap;
padding: 18rpx 24rpx; padding: 18rpx 24rpx;
overflow: hidden; overflow: hidden;
border-radius: 28rpx;
} }
.u-swiper { .u-swiper {

1
uview-ui/components/u-notice-bar/u-notice-bar.vue

@ -219,6 +219,7 @@ export default {
.u-notice-bar-wrap { .u-notice-bar-wrap {
overflow: hidden; overflow: hidden;
border-radius: 28rpx;
} }
.u-notice-bar { .u-notice-bar {

Loading…
Cancel
Save