Browse Source

路由分发

master
邓平艺 4 years ago
parent
commit
3adabfcf42
  1. 7
      pages.json
  2. 11
      pages/address/add/add.less
  3. 7
      pages/address/add/add.vue
  4. 13
      pages/business/withdrawal/withdrawal.vue
  5. 8
      pages/index/index/index.vue
  6. 40
      pages/order/cashier/cashier.vue
  7. 51
      pages/route/index.vue
  8. 103
      pages/shop/goodsdetail.vue
  9. 2
      pages/shop/seckillList.vue
  10. 10
      pages/shop/shopdetail.vue
  11. 37
      pages/user/member/code.vue

7
pages.json

@ -517,6 +517,13 @@
"navigationBarTitleText": "活动列表" ,
"navigationStyle":"custom"
}
},
{
"path": "pages/route/index",
"style": {
"navigationBarTitleText": "路由分发" ,
"navigationStyle":"custom"
}
}
],
"globalStyle": {

11
pages/address/add/add.less

@ -10,8 +10,8 @@
background: #FFFFFF;
padding: 0 32rpx;
.info-item{
height: 40px;
line-height: 40px;
height: 60px;
line-height: 60px;
// padding-left: 15px;
display: flex;
align-items: center;
@ -26,7 +26,7 @@
width: 80px;
display: block;
color:#666666;
font-size: 13px;
font-size: 28rpx;
font-weight: 400;
}
@ -36,7 +36,7 @@
input{
width: 100%;
font-size: 13px;
font-size: 28rpx;
box-sizing: border-box;
outline: 0;
border: none;
@ -59,6 +59,9 @@
text-overflow: ellipsis;
overflow: hidden;
height: 40px;
font-size: 28rpx;
display: flex;
align-items: center;
}
}
}

7
pages/address/add/add.vue

@ -73,14 +73,13 @@
<input type="text" id="address" data-type="address" placeholder="请输入详细地址" :value="detail.address" @input="input" />
</view>
</view>
<!-- TODO -->
<view class="info-item">
<label for="name">门牌号:</label>
<view class="form-control">
<input type="text" id="name" placeholder="请输入门牌号(选填)" data-type="house_num" :value="detail.house_num" @input="input" />
</view>
</view>
<view class="info-item">
<view class="info-item lf-m-t-10">
<label class="checkbox" @tap="check">
<!-- #ifdef H5 -->
<checkbox color="red" :checked="detail.is_default"></checkbox>
@ -95,13 +94,13 @@
</label>
</view>
</view>
<view class="identify-address">
<!-- <view class="identify-address">
<textarea @input="changeIdentify" :value="address_text" placeholder-class="textarea-placeholder" placeholder="粘贴或输入整段地址,点击“识别”自动拆分姓名、电话和地址。" />
<view class="btn-box" v-if="address_text">
<view class="clear" @tap="clearInfo">清空</view>
<view class="sure" @tap="sureAddress">识别</view>
</view>
</view>
</view> -->
<view class="button-box">
<button type="primary" :style="'background: ' + config.mainColor" class="submit" @tap="submit" :loading="loading">保存</button>
<!-- <button type="warn" class="delete" :style="'background: ' + config.secColor" v-if="id" @tap="deleteAddress" :loading="deleteLoading">删除</button> -->

13
pages/business/withdrawal/withdrawal.vue

@ -122,7 +122,8 @@
token: '',
remark: [], //
brand: {}, //
balance: 0 //
balance: 0, //
button_click: false
}
},
computed: {
@ -175,6 +176,8 @@
}
},
launch(type_name){
if(this.button_click) return;
this.button_click = true;
uni.showLoading({
title: '正在提现中'
})
@ -212,9 +215,15 @@
this.money = '';
this.$msg('提现成功', {icon: 'success', duration: 2500});
this.getApplyInfo();
}else{
this.$msg('提现失败', {icon: 'error'});
}
this.button_click = false;
uni.hideLoading();
}).catch(err => uni.hideLoading());
}).catch(err => {
this.button_click = false;
uni.hideLoading();
});
}
}
}

8
pages/index/index/index.vue

@ -1086,7 +1086,13 @@
});
}
}
},
onShareAppMessage(){
return {
title: '欢迎使用金城优选小程序!',
path: '/pages/route/index?route=home'
}
}
};
</script>

40
pages/order/cashier/cashier.vue

@ -36,14 +36,17 @@
</view>
<view class="fixed-btn" hover-class="lf-opacity" @click="confirm">立即支付</view>
<view class="fixed-agreement">购买须知</view>
<lf-pay-password v-if="show_pw" @comfirm="payComfirm" title="请输入支付密码"></lf-pay-password>
</view>
</template>
<script>
import countdownTimer from '@/components/countdown-timer/countdown-timer';
import lfPayPassword from '@/components/lf-payPassword/lf-payPassword.vue'
export default {
components: {
countdownTimer
countdownTimer,
lfPayPassword
},
data(){
return {
@ -63,7 +66,9 @@
amount: '',
order_no: '',
token: '',
balance_sum: 0
balance_sum: 0,
show_pw: false,
user_pw: ''
}
},
onLoad(options){
@ -104,23 +109,37 @@
this.$toBack();
})
},
//
payComfirm(event){
this.user_pw = event;
this.show_pw = false;
},
//
confirm(){
if(this.is_date_finish) return this.$msg('订单超时未支付');
let channel = '';
this.pay_list.map(item => {
if(item.checked){
channel = item.type;
}
})
if(channel == 'balance' && !this.user_pw){
this.show_pw = true;
return;
}
this.getOpenid().then(res => {
let channel = '';
this.pay_list.map(item => {
if(item.checked){
channel = item.type;
}
})
var data = {
channel: channel == 'balance' ? 'wx_lite' : channel,
channel: 'wx_lite',
openid: res,
order_no: this.order_no,
balance: channel == 'balance' ? Number(this.amount) : 0
balance: 0
};
if(channel == 'balance'){
data.pay_pwd = this.user_pw;
data.balance = Number(this.amount);
data.channel = 'wx_lite';
}
this.$http.post({
api: `api/shopping/order/charge`,
@ -129,6 +148,7 @@
Authorization: this.token
}
}).then(res => {
console.log("-------------------", res)
res = res.data;
if (res.status) {
// this.formId = e.detail.formId || '';

51
pages/route/index.vue

@ -0,0 +1,51 @@
<template>
<view></view>
</template>
<script>
/* 路由分发页面仅供跳转页面 */
export default {
onLoad(options){
this.routeToPage(options);
},
methods: {
//
routeToPage(options){
if(options.route == 'detail'){
options.page_url = '/pages/shop/goodsdetail';
this.joinPagePath(options);
}else if(options.route == 'home'){
options.page_url = '/pages/index/index/index';
this.joinPagePath(options);
}else if(options.route == 'shop'){
options.page_url = '/pages/shop/shopdetail';
this.joinPagePath(options);
}else{
let obj = {
page_url: '/pages/index/index/index' //
};
this.joinPagePath(obj);
}
},
//
joinPagePath(par){
let path = par.page_url;
let flag = true; //
for(let i in par){
if(i != 'route' && i != 'page_url' && i != 'is_tabbar'){ // routepage_urlis_tabbar
if(flag){
path += '?'+ i +'='+ par[i];
flag = false;
}else{
path += '&'+ i +'='+ par[i];
}
}
}
this.$url(path, {type: 'redirect'});
}
}
}
</script>
<style>
</style>

103
pages/shop/goodsdetail.vue

@ -9,7 +9,7 @@
<image mode="aspectFill" :src="item" style="width: 100%; height: 100%;" @click="lookImg(index)"></image>
<view class="seckill-box" v-if="type == 'seckill'">
<view>距离结束还剩余</view>
<view>
<view v-if="time != 0">
<countdown-timer :time="time" :autoStart="true" @finish="dateFinish">
<template v-slot="{day, hour, minute, second}">
<view class="lf-flex">
@ -268,7 +268,9 @@
token: '',
coupons: [], //
goods_num: 1,
is_date_finish: false
is_date_finish: false,
show_share: false,
shareImg: ''
}
},
computed: {
@ -389,7 +391,7 @@
}
}
},
// TODO
//
confirm(){
if(this.is_date_finish){
return this.$msg('活动已结束');
@ -496,46 +498,64 @@
},
//
shareGraphic(){
this.getCreateShareImg();
this.getShearImg();
},
//h5
getCreateShareImg(){
wx.showLoading({
title:"生成中",
mask:true
})
let origin = window.location.origin;
let share_url = origin+'/pages/store/detail/detail';
this.$http.get({
api:'api/distribution/createH5ShareImg',
data:{
goods_id:this.id,
share_url:share_url
}
}).then(res=>{
res = res.data;
if(res.status){
this.qr_code_image = res.data.image;
//
getShearImg() {
wx.showLoading({
title: "生成中",
mask: true
});
var token = this.token;
this.$http.get({
api: 'api/distribution/createMiniShareImg',
header: {
Authorization: token
},
data: {
goods_id: this.goods_id
}
}).then(res => {
if (res.statusCode == 200) {
res = res.data;
if(this.qr_code_image){
this.share_gaphic =!this.share_gaphic;
this.is_toggle_share = false;
}
} else{
wx.showModal({
content: res.message || '请求失败,请重试',
showCancel: false
});
}
wx.hideLoading()
}).catch(rej=>{
wx.hideLoading()
wx.showModal({
content: rej.message || '内部错误,请重试',
showCancel: false
});
})
if (res.status) {
this.setData({
shareImg: res.data.image
});
setTimeout(() => {
this.changeImg();
}, 100)
} else {
wx.showModal({
content: res.message || '请求失败',
showCancel: false
});
}
} else {
wx.showModal({
content: '请求失败',
showCancel: false
});
}
wx.hideLoading();
this.changeShare();
}).catch(rej => {
wx.showModal({
content: '内部错误',
showCancel: false
});
wx.hideLoading();
this.changeShare();
});
},
//
changeShare() {
this.setData({
show_share: !this.show_share
});
},
//
getNewdetail(){
@ -560,6 +580,7 @@
this.seckill = meta.seckill;
let currentDate = this.$shared.recordTime();
this.time = new Date(meta.seckill.ends_at).getTime() - new Date(currentDate).getTime()
console.log("time", this.time, meta.seckill.ends_at, currentDate)
}
if(type != 'point'){
this.getBrandDetail(goods_detail.brand_id);

2
pages/shop/seckillList.vue

@ -172,11 +172,13 @@
var date = this.getTime()
let time = new Date(item.seckill.starts_at).getTime() - new Date(date).getTime()
this.$set(item,'countTime',time)
console.log("time", time);
}else {
this.$set(item,'ifStart',true)
var date = this.getTime()
let time = new Date(item.seckill.ends_at).getTime() - new Date(date).getTime()
this.$set(item,'countTime',time)
console.log("time", time);
}
})

10
pages/shop/shopdetail.vue

@ -18,7 +18,7 @@
</view>
</view>
<view class="function-total">
<button class="lf-row-center lf-flex-column menu-btn" @click="$url('/pages/user/my/chatonline')">
<button class="lf-row-center lf-flex-column menu-btn" @click="call">
<view><text class="lf-iconfont icon-pinglun shop-function"></text></view>
<view class="lf-font-24 lf-color-33">客服</view>
</button>
@ -179,6 +179,11 @@
this.getData();
}
},
call(){
uni.makePhoneCall({
phoneNumber: String(this.detail.tel)
})
},
initGoodsTabs(){
let _public = {
isRefresher: false,
@ -289,7 +294,8 @@
},
onShareAppMessage(){
return {
title: '给你分享了一家店铺,我觉得很不错哦~'
title: `给你分享一家店铺[${this.detail.name}],我觉得很不错哦~`,
path: '/pages/route/index?route=shop&id='+ this.brand_id
}
}
}

37
pages/user/member/code.vue

@ -71,7 +71,7 @@
onLoad(){
var token = this.$cookieStorage.get('user_token');
this.token = token;
this.getIsSetPayPwd();
this.getIsSetPayPwd({first: true});
this.getMeInfo();
this.getUcenter();
},
@ -109,7 +109,7 @@
},
methods: {
//
getIsSetPayPwd(){
getIsSetPayPwd(options = {}){
this.$http.post({
api: 'api/user/isset_pay_pwd',
header: {
@ -118,7 +118,7 @@
}).then(res => {
console.log("====",res)
if(res.data.status){
this.refreshCode();
this.refreshCode(options);
}else{
uni.showModal({
title: '温馨提示',
@ -164,12 +164,12 @@
return pxWidth;
},
// code
refreshCode(){
refreshCode(options){
if(this.timer){
clearInterval(this.timer);
this.timer = null;
}
this.getPay();
this.getPay(options);
this.timer = setInterval(() => {
this.num--;
if(this.num % 5 === 0){
@ -184,6 +184,7 @@
}, 1000);
},
getPay(options = {}){
console.log("options------",options)
if(!options.silence){
if(this.show_code_count >= 1){
uni.showLoading({
@ -196,10 +197,18 @@
}
}
this.first_http++;
let cancel = 0;
if(this.first_http <= 1){
cancel = 2;
}
if(options.first){
cancel = 1;
}
this.$http.get({
api: 'api/offline/get_pay',
data: {
cancel: this.first_http <= 1 ? 1 : 0
cancel: cancel
},
header: {
Authorization: this.token
@ -208,14 +217,16 @@
if(res.data.code == 200){
let detail = res.data.data;
let u_id = this.userInfo.id;
let str = JSON.stringify({
rand: detail.rand,
time: detail.time,
u_id: u_id
});
this.config.bar.code = str;
this.config.qrc.code = str;
if(!options.silence){
let str = JSON.stringify({
rand: detail.rand,
time: detail.time,
u_id: u_id
});
this.config.bar.code = str;
this.config.qrc.code = str;
this.show_code = true;
this.show_code_count++;
}

Loading…
Cancel
Save