Browse Source

支付增加订阅功能,增加海报生成传递from类型

master
Gao xiaosong 5 years ago
parent
commit
a004ec3b10
  1. 4
      api/store.js
  2. 343
      components/StorePoster.vue
  3. 4
      config/index.js
  4. 28
      libs/order.js
  5. 19
      libs/wechat.js
  6. 128
      pages/activity/Poster/index.vue
  7. 735
      pages/order/OrderSubmission/index.vue
  8. 6
      pages/shop/StoreList/index.vue
  9. 609
      pages/user/Recharge/index.vue
  10. 25
      pages/user/address/AddAddress/index.vue
  11. 253
      pages/user/promotion/Poster/index.vue
  12. 12
      store/index.js

4
api/store.js

@ -75,8 +75,8 @@ export function getGroomList(type) {
/* /*
* 获取商品海报 * 获取商品海报
* */ * */
export function getProductPoster(id) { export function getProductPoster(id, data) {
return request.get("/product/poster/" + id, {}, { return request.get("/product/poster/" + id, data, {
login: true login: true
}); });
} }

343
components/StorePoster.vue

@ -29,19 +29,8 @@
<view class="save-poster" @click="savePosterPath">生成图片</view> <view class="save-poster" @click="savePosterPath">生成图片</view>
</view>--> </view>-->
<view class="poster-pop" v-show="canvasStatus"> <view class="poster-pop" v-show="canvasStatus">
<img <img src="@/static/images/poster-close.png" class="close" @click="posterImageClose" mode="widthFix" />
src="@/static/images/poster-close.png" <image :src="posterImage" alt="tp" class="poster-image" show-menu-by-longpress mode="widthFix" />
class="close"
@click="posterImageClose"
mode="widthFix"
/>
<image
:src="posterImage"
alt="tp"
class="poster-image"
show-menu-by-longpress
mode="widthFix"
/>
<view class="keep">长按图片可以保存到手机</view> <view class="keep">长按图片可以保存到手机</view>
</view> </view>
<view class="mask"></view> <view class="mask"></view>
@ -49,163 +38,187 @@
</template> </template>
<script> <script>
// import html2canvas from "html2canvas"; // import html2canvas from "html2canvas";
import { PosterCanvas } from "@/utils"; import {
import { getProductPoster } from "@/api/store"; PosterCanvas
} from "@/utils";
export default { import {
name: "StorePoster", getProductPoster
props: { } from "@/api/store";
posterImageStatus: Boolean,
posterData: Object, export default {
goodId: String name: "StorePoster",
}, props: {
data: function() { posterImageStatus: Boolean,
return { posterData: Object,
canvasStatus: false, goodId: String
posterImage: "" },
}; data: function () {
}, return {
watch: { canvasStatus: false,
posterImageStatus: function() { posterImage: ""
var that = this; };
if (that.posterImageStatus === true) { },
that.$nextTick(function() { watch: {
that.savePosterPath(); posterImageStatus: function () {
}); var that = this;
if (that.posterImageStatus === true) {
that.$nextTick(function () {
that.savePosterPath();
});
}
} }
}
},
mounted: function() {},
methods: {
posterImageClose: function() {
this.posterImageStatus = false;
this.canvasStatus = false;
this.$emit("setPosterImageStatus");
}, },
savePosterPath: function() { mounted: function () {},
const that = this; methods: {
posterImageClose: function () {
uni.showLoading({ title: "海报生成中", mask: true }); this.posterImageStatus = false;
getProductPoster(this.goodId) this.canvasStatus = false;
.then(res => { this.$emit("setPosterImageStatus");
this.canvasStatus = true; },
this.posterImage = res.data; savePosterPath: function () {
}) const that = this;
.finally(() => {
uni.hideLoading(); uni.showLoading({
title: "海报生成中",
mask: true
}); });
// return; getProductPoster(this.goodId, {
// // from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType
// that.posterImage = ""; })
// uni.showLoading({ title: "", mask: true }); .then(res => {
// console.log(this); this.canvasStatus = true;
// var prodId = that.$yrouter.currentRoute.query.id; this.posterImage = res.data;
// uni.downloadFile({ })
// url: .finally(() => {
// this.$VUE_APP_API_URL + uni.hideLoading();
// "/shareImg/" + });
// prodId + // return;
// "?shareImgName=" + // //
// this.posterData.code, // that.posterImage = "";
// fail: function(res) {}, // uni.showLoading({ title: "", mask: true });
// success: function(res) { // console.log(this);
// console.log(res); // var prodId = that.$yrouter.currentRoute.query.id;
// that.canvasStatus = true; // uni.downloadFile({
// that.posterImage = res.tempFilePath; // url:
// uni.hideLoading(); // this.$VUE_APP_API_URL +
// } // "/shareImg/" +
// }); // prodId +
// "?shareImgName=" +
// this.posterData.code,
// fail: function(res) {},
// success: function(res) {
// console.log(res);
// that.canvasStatus = true;
// that.posterImage = res.tempFilePath;
// uni.hideLoading();
// }
// });
}
} }
} };
};
</script> </script>
<style scoped lang="less" lang="less"> <style scoped lang="less" lang="less">
.poster-first { .poster-first {
overscroll-behavior: contain; overscroll-behavior: contain;
} }
.poster-pop {
width: 4.5 * 100rpx; .poster-pop {
height: 8 * 100rpx; width: 4.5 * 100rpx;
position: fixed; height: 8 * 100rpx;
left: 50%; position: fixed;
transform: translateX(-50%); left: 50%;
z-index: 99; transform: translateX(-50%);
top: 50%; z-index: 99;
margin-top: -4.6 * 100rpx; top: 50%;
} margin-top: -4.6 * 100rpx;
.poster-pop .canvas { }
background-color: #ffffff;
height: 8 * 100rpx; .poster-pop .canvas {
} background-color: #ffffff;
.poster-pop .poster-image { height: 8 * 100rpx;
width: 100%; }
height: auto;
} .poster-pop .poster-image {
.poster-pop .canvas .image { width: 100%;
width: 4.5 * 100rpx; height: auto;
height: 4.5 * 100rpx; }
display: block;
} .poster-pop .canvas .image {
.poster-pop .canvas .text { width: 4.5 * 100rpx;
text-align: center; height: 4.5 * 100rpx;
color: #000000; display: block;
margin-top: 0.32 * 100rpx; }
}
.poster-pop .canvas .text.black { .poster-pop .canvas .text {
height: 0.68 * 100rpx; text-align: center;
} color: #000000;
.poster-pop .canvas .text.rad { margin-top: 0.32 * 100rpx;
color: #ff0000; }
}
.poster-pop .canvas .code { .poster-pop .canvas .text.black {
height: 1.4 * 100rpx; height: 0.68 * 100rpx;
display: flex; }
}
.poster-pop .canvas .code .code-img { .poster-pop .canvas .text.rad {
width: 33%; color: #ff0000;
padding: 0.06 * 100rpx; }
}
.poster-pop .canvas .code .code-img image { .poster-pop .canvas .code {
width: 100%; height: 1.4 * 100rpx;
} display: flex;
.poster-pop .canvas .code .code-text { }
width: 60%;
font-size: 0.12 * 100rpx; .poster-pop .canvas .code .code-img {
line-height: 1.64 * 100rpx; width: 33%;
} padding: 0.06 * 100rpx;
.poster-pop .close { }
width: 0.46 * 100rpx;
height: 0.75 * 100rpx; .poster-pop .canvas .code .code-img image {
position: fixed; width: 100%;
right: 0; }
top: -0.73 * 100rpx;
display: block; .poster-pop .canvas .code .code-text {
} width: 60%;
.poster-pop .save-poster { font-size: 0.12 * 100rpx;
background-color: #df2d0a; line-height: 1.64 * 100rpx;
font-size: 0.22 * 100rpx; }
color: #fff;
text-align: center; .poster-pop .close {
height: 0.76 * 100rpx; width: 0.46 * 100rpx;
line-height: 0.76 * 100rpx; height: 0.75 * 100rpx;
width: 100%; position: fixed;
margin-top: -0.04 * 100rpx; right: 0;
} top: -0.73 * 100rpx;
.poster-pop .keep { display: block;
color: #fff; }
text-align: center;
font-size: 0.25 * 100rpx; .poster-pop .save-poster {
margin-top: 0.1 * 100rpx; background-color: #df2d0a;
} font-size: 0.22 * 100rpx;
.mask { color: #fff;
position: fixed; text-align: center;
top: 0; height: 0.76 * 100rpx;
left: 0; line-height: 0.76 * 100rpx;
right: 0; width: 100%;
bottom: 0; margin-top: -0.04 * 100rpx;
background-color: rgba(0, 0, 0, 0.6); }
z-index: 9;
} .poster-pop .keep {
color: #fff;
text-align: center;
font-size: 0.25 * 100rpx;
margin-top: 0.1 * 100rpx;
}
.mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.6);
z-index: 9;
}
</style> </style>

4
config/index.js

@ -1,11 +1,7 @@
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api'; // export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api';
<<<<<<< HEAD
export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api'; // export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api';
=======
export const VUE_APP_API_URL = 'http://h5api.xinxintuan.co/api'; export const VUE_APP_API_URL = 'http://h5api.xinxintuan.co/api';
>>>>>>> 2723cab7364b2e3e5d2ec4f2cd941461a936cb95
export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static'; export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static';

28
libs/order.js

@ -81,7 +81,7 @@ export async function payOrderHandle(orderId, type, from) {
}); });
payOrder(orderId, type, from) payOrder(orderId, type, from)
.then(async res => { .then(async res => {
await handleOrderPayResults(res.data) await handleOrderPayResults(res.data, type)
resolve() resolve()
}) })
.catch(err => { .catch(err => {
@ -98,7 +98,9 @@ export async function payOrderHandle(orderId, type, from) {
// 处理调用支付接口的逻辑 // 处理调用支付接口的逻辑
// @type create(创建订单)||pay(支付订单) // @type create(创建订单)||pay(支付订单)
export function handleOrderPayResults(data, type) { export function handleOrderPayResults(data, type, payType) {
console.log(data, type, payType)
console.log(data, type) console.log(data, type)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.hideLoading() uni.hideLoading()
@ -156,19 +158,37 @@ export function handleOrderPayResults(data, type) {
weappPay(data.result.jsConfig).finally(() => { weappPay(data.result.jsConfig).finally(() => {
resolve() resolve()
goOrderDetails(data.result.orderId, type) goOrderDetails(data.result.orderId, type)
}); }).then(res => {
// #ifdef MP-WEIXIN
subscribeMessage()
// #endif
})
break; break;
// APP支付 // APP支付
case "WECHAT_APP_PAY": case "WECHAT_APP_PAY":
weappPay(data.result.jsConfig).finally(() => { weappPay(data.result.jsConfig).finally(() => {
resolve() resolve()
goOrderDetails(data.result.orderId, type) goOrderDetails(data.result.orderId, type)
}); })
break; break;
} }
}) })
} }
export function subscribeMessage() {
// 调用订阅
console.log('调用订阅')
uni.requestSubscribeMessage({
tmplIds: ['W5r2c2kzhbq8uxStkPAVx_sk-5aapMFCqe7b7KU5jXI', '2CB_1UyQrbnlyjJa5syraqJ3cfztPPDOAHe3DEXpMjg', 'vuztugw9VbKbKJDAAVePkjqPpT5mdoREpd4Aq7EGPRU'],
success(res) {
console.log(res)
},
fail(error){
console.log(error)
}
})
}
export function goOrderDetails(id, type) { export function goOrderDetails(id, type) {
// 创建订单时跳转到详情 // 创建订单时跳转到详情

19
libs/wechat.js

@ -1,3 +1,4 @@
import { subscribeMessage } from "@/libs/order";
import { getProvider } from "@/utils"; import { getProvider } from "@/utils";
import WechatJSSDK from "wechat-jssdk/dist/client.umd"; import WechatJSSDK from "wechat-jssdk/dist/client.umd";
import { getWechatConfig, wechatAuth } from "@/api/public"; import { getWechatConfig, wechatAuth } from "@/api/public";
@ -9,7 +10,6 @@ import dayjs from "dayjs";
// 支付模块 // 支付模块
export const weappPay = (option) => { export const weappPay = (option) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log(option)
if (store.state.$deviceType == 'weixinh5') { if (store.state.$deviceType == 'weixinh5') {
setTimeout(() => { setTimeout(() => {
location.href = option.mweb_url; location.href = option.mweb_url;
@ -59,11 +59,16 @@ export const weappPay = (option) => {
clearTimeout(time) clearTimeout(time)
resolve(success) resolve(success)
}, 3000) }, 3000)
// #ifdef MP-WEIXIN
subscribeMessage()
// #endif
}, },
fail: (error) => { fail: (error) => {
console.log(error) console.log(error)
if (error.errMsg == 'requestPayment:fail cancel') { if (error.errMsg == 'requestPayment:fail cancel') {
uni.showToast({ title: '已取消支付', icon: 'none', duration: 5000 }); uni.showToast({ title: '已取消支付', icon: 'none', duration: 5000 });
} else {
uni.showToast({ title: error || error.msg, icon: 'none', duration: 5000 });
} }
reject(error) reject(error)
} }
@ -344,12 +349,20 @@ export function wxShowLocation() {
cancel() { cancel() {
cookie.remove(LATITUDE); cookie.remove(LATITUDE);
cookie.remove(LONGITUDE); cookie.remove(LONGITUDE);
this.$dialog.error("取消获取位置"); uni.showToast({
title: "取消获取位置",
icon: "none",
duration: 2000,
});
}, },
fail() { fail() {
cookie.remove(LATITUDE); cookie.remove(LATITUDE);
cookie.remove(LONGITUDE); cookie.remove(LONGITUDE);
this.$dialog.error("授权失败"); uni.showToast({
title: "授权失败",
icon: "none",
duration: 2000,
});
} }
}); });
} }

128
pages/activity/Poster/index.vue

@ -9,71 +9,81 @@
</view> </view>
</template> </template>
<script> <script>
import { getBargainPoster, getCombinationPoster } from "@/api/activity"; import {
getBargainPoster,
getCombinationPoster
} from "@/api/activity";
export default { export default {
name: "Poster", name: "Poster",
components: {}, components: {},
props: {}, props: {},
data: function() { data: function () {
return { return {
status: true, status: true,
id: 0, id: 0,
image: "" image: ""
}; };
},
mounted: function() {
var that = this;
var id = that.$yroute.query.id;
var type = that.$yroute.query.type;
that.id = id;
if (type == 2) {
that.getBargainPoster();
} else {
that.getCombinationPoster();
}
},
methods: {
getBargainPoster: function() {
var that = this;
getBargainPoster({ bargainId: that.id, from: "wechat" })
.then(res => {
that.image = res.data.url;
that.status = false;
})
.catch(res => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
});
}, },
// mounted: function () {
getCombinationPoster: function() {
var that = this; var that = this;
getCombinationPoster({ id: that.id, from: "wechat" }) var id = that.$yroute.query.id;
.then(res => { var type = that.$yroute.query.type;
that.image = res.data.url; that.id = id;
that.status = false; if (type == 2) {
}) that.getBargainPoster();
.catch(res => { } else {
uni.showToast({ that.getCombinationPoster();
title: res.msg, }
icon: "none", },
duration: 2000 methods: {
getBargainPoster: function () {
var that = this;
getBargainPoster({
bargainId: that.id,
from: "wechat"
})
.then(res => {
that.image = res.data.url;
that.status = false;
})
.catch(res => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
});
},
//
getCombinationPoster: function () {
var that = this;
getCombinationPoster({
id: that.id,
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType
})
.then(res => {
that.image = res.data.url;
that.status = false;
})
.catch(res => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
}); });
}); }
} }
} };
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
page { page {
background-color: #eb3729; background-color: #eb3729;
} }
.poster-poster {
height: unset !important; .poster-poster {
} height: unset !important;
}
</style> </style>

735
pages/order/OrderSubmission/index.vue

@ -2,24 +2,12 @@
<view class="order-submission"> <view class="order-submission">
<view class="allAddress" :style="systemStore ? '' : 'padding-top: 0.2*100rpx'"> <view class="allAddress" :style="systemStore ? '' : 'padding-top: 0.2*100rpx'">
<view class="nav acea-row"> <view class="nav acea-row">
<view <view class="item font-color-red" :class="shipping_type === 0 ? 'on' : 'on2'" @click="addressType(0)"
class="item font-color-red" v-if="systemStore"></view>
:class="shipping_type === 0 ? 'on' : 'on2'" <view class="item font-color-red" :class="shipping_type === 1 ? 'on' : 'on2'" @click="addressType(1)"
@click="addressType(0)" v-if="systemStore"></view>
v-if="systemStore"
></view>
<view
class="item font-color-red"
:class="shipping_type === 1 ? 'on' : 'on2'"
@click="addressType(1)"
v-if="systemStore"
></view>
</view> </view>
<view <view class="address acea-row row-between-wrapper" v-if="shipping_type === 0" @click="addressTap">
class="address acea-row row-between-wrapper"
v-if="shipping_type === 0"
@click="addressTap"
>
<view class="addressCon" v-if="addressInfo.realName"> <view class="addressCon" v-if="addressInfo.realName">
<view class="name"> <view class="name">
{{ addressInfo.realName }} {{ addressInfo.realName }}
@ -35,11 +23,7 @@
</view> </view>
<view class="iconfont icon-jiantou"></view> <view class="iconfont icon-jiantou"></view>
</view> </view>
<div <div class="address acea-row row-between-wrapper" v-if="shipping_type === 1" @click="showStoreList">
class="address acea-row row-between-wrapper"
v-if="shipping_type === 1"
@click="showStoreList"
>
<div class="addressCon" v-if="storeItems"> <div class="addressCon" v-if="storeItems">
<div class="name"> <div class="name">
{{ storeItems.name }} {{ storeItems.name }}
@ -69,10 +53,7 @@
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
</view> </view>
</view> </view>
<view <view class="item acea-row row-between-wrapper" v-if="deduction === false && enableIntegral === true">
class="item acea-row row-between-wrapper"
v-if="deduction === false && enableIntegral === true"
>
<view>积分抵扣</view> <view>积分抵扣</view>
<view class="discount"> <view class="discount">
<view class="select-btn"> <view class="select-btn">
@ -124,33 +105,21 @@
<view class="item"> <view class="item">
<view>支付方式</view> <view>支付方式</view>
<view class="list"> <view class="list">
<view <view class="payItem acea-row row-middle" :class="active === 'weixin' ? 'on' : ''" @click="payItem('weixin')"
class="payItem acea-row row-middle" v-show="isWeixin">
:class="active === 'weixin' ? 'on' : ''"
@click="payItem('weixin')"
v-show="isWeixin"
>
<view class="name acea-row row-center-wrapper"> <view class="name acea-row row-center-wrapper">
<view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view>微信支付 <view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view>微信支付
</view> </view>
<view class="tip">微信快捷支付</view> <view class="tip">微信快捷支付</view>
</view> </view>
<view <view class="payItem acea-row row-middle" :class="active === 'weixin' ? 'on' : ''" @click="payItem('weixin')"
class="payItem acea-row row-middle" v-show="!isWeixin">
:class="active === 'weixin' ? 'on' : ''"
@click="payItem('weixin')"
v-show="!isWeixin"
>
<view class="name acea-row row-center-wrapper"> <view class="name acea-row row-center-wrapper">
<view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view>微信支付 <view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view>微信支付
</view> </view>
<view class="tip">微信快捷支付</view> <view class="tip">微信快捷支付</view>
</view> </view>
<view <view class="payItem acea-row row-middle" :class="active === 'yue' ? 'on' : ''" @click="payItem('yue')">
class="payItem acea-row row-middle"
:class="active === 'yue' ? 'on' : ''"
@click="payItem('yue')"
>
<view class="name acea-row row-center-wrapper"> <view class="name acea-row row-center-wrapper">
<view class="iconfont icon-icon-test" :class="active === 'yue' ? 'bounceIn' : ''"></view>余额支付 <view class="iconfont icon-icon-test" :class="active === 'yue' ? 'bounceIn' : ''"></view>余额支付
</view> </view>
@ -185,392 +154,396 @@
</view> </view>
<view class="settlement" @click="createOrder">立即结算</view> <view class="settlement" @click="createOrder">立即结算</view>
</view> </view>
<CouponListWindow <CouponListWindow v-on:couponchange="changecoupon($event)" v-model="showCoupon" :price="orderPrice.totalPrice"
v-on:couponchange="changecoupon($event)" :checked="usableCoupon.id" @checked="changeCoupon" :cartid="cartid"></CouponListWindow>
v-model="showCoupon" <AddressWindow @checked="changeAddress" @redirect="addressRedirect" v-model="showAddress" :checked="addressInfo.id"
:price="orderPrice.totalPrice" ref="mychild"></AddressWindow>
:checked="usableCoupon.id"
@checked="changeCoupon"
:cartid="cartid"
></CouponListWindow>
<AddressWindow
@checked="changeAddress"
@redirect="addressRedirect"
v-model="showAddress"
:checked="addressInfo.id"
ref="mychild"
></AddressWindow>
</view> </view>
</template> </template>
<style scoped lang="less"> <style scoped lang="less">
.order-submission .wrapper .shipping select { .order-submission .wrapper .shipping select {
color: #999; color: #999;
padding-right: 0.15 * 100rpx; padding-right: 0.15 * 100rpx;
} }
.order-submission .wrapper .shipping .iconfont { .order-submission .wrapper .shipping .iconfont {
font-size: 0.3 * 100rpx; font-size: 0.3 * 100rpx;
color: #515151; color: #515151;
} }
.order-submission .allAddress { .order-submission .allAddress {
width: 100%; width: 100%;
background-image: linear-gradient(to bottom, #eb3729 0%, #eb3729 100%); background-image: linear-gradient(to bottom, #eb3729 0%, #eb3729 100%);
background-image: -webkit-linear-gradient( background-image: -webkit-linear-gradient(to bottom,
to bottom, #eb3729 0%,
#eb3729 0%, #eb3729 100%);
#eb3729 100% background-image: -moz-linear-gradient(to bottom, #eb3729 0%, #eb3729 100%);
); padding-top: 1 * 100rpx;
background-image: -moz-linear-gradient(to bottom, #eb3729 0%, #eb3729 100%); }
padding-top: 1 * 100rpx;
}
.order-submission .allAddress .nav { .order-submission .allAddress .nav {
margin: 0 auto; margin: 0 auto;
padding: 0 30rpx; padding: 0 30rpx;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
} }
.order-submission .allAddress .nav .item { .order-submission .allAddress .nav .item {
flex: 1; flex: 1;
position: relative; position: relative;
} }
.order-submission .allAddress .nav .item.on { .order-submission .allAddress .nav .item.on {
position: relative; position: relative;
} }
.order-submission .allAddress .nav .item.on:before { .order-submission .allAddress .nav .item.on:before {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
content: "快递配送"; content: "快递配送";
font-size: 0.28 * 100rpx; font-size: 0.28 * 100rpx;
display: block; display: block;
height: 0; height: 0;
left: 0; left: 0;
right: 0; right: 0;
border-width: 0.4 * 100rpx; border-width: 0.4 * 100rpx;
border-style: solid; border-style: solid;
border-color: #fff; border-color: #fff;
z-index: 9; z-index: 9;
text-align: center; text-align: center;
line-height: 0.14 * 100rpx; line-height: 0.14 * 100rpx;
} }
.order-submission .allAddress .nav .item:nth-of-type(2).on:before { .order-submission .allAddress .nav .item:nth-of-type(2).on:before {
content: "到店自提"; content: "到店自提";
border-width: 0.4 * 100rpx; border-width: 0.4 * 100rpx;
} }
.order-submission .allAddress .nav .item.on2 { .order-submission .allAddress .nav .item.on2 {
position: relative; position: relative;
} }
.order-submission .allAddress .nav .item.on2:before { .order-submission .allAddress .nav .item.on2:before {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
content: "到店自提"; content: "到店自提";
font-size: 0.28 * 100rpx; font-size: 0.28 * 100rpx;
display: block; display: block;
height: 0; height: 0;
left: 0; left: 0;
right: 0; right: 0;
border-width: 0.4 * 100rpx; border-width: 0.4 * 100rpx;
border-style: solid; border-style: solid;
border-color: #d5e6e6; border-color: #d5e6e6;
text-align: center; text-align: center;
line-height: 0.14 * 100rpx; line-height: 0.14 * 100rpx;
} }
.order-submission .allAddress .nav .item:nth-of-type(1).on2:before { .order-submission .allAddress .nav .item:nth-of-type(1).on2:before {
content: "快递配送"; content: "快递配送";
border-width: 0.4 * 100rpx; border-width: 0.4 * 100rpx;
} }
.order-submission .allAddress .address { .order-submission .allAddress .address {
width: 6.91 * 100rpx; width: 6.91 * 100rpx;
height: 1.5 * 100rpx; height: 1.5 * 100rpx;
margin: 0 auto; margin: 0 auto;
box-sizing: border-box; box-sizing: border-box;
} }
.order-submission .allAddress .line { .order-submission .allAddress .line {
width: 7.1 * 100rpx; width: 7.1 * 100rpx;
margin: 0 auto; margin: 0 auto;
} }
.order-submission .wrapper .item .discount input::placeholder { .order-submission .wrapper .item .discount input::placeholder {
color: #ccc; color: #ccc;
} }
</style> </style>
<script> <script>
import OrderGoods from "@/components/OrderGoods"; import OrderGoods from "@/components/OrderGoods";
import CouponListWindow from "@/components/CouponListWindow"; import CouponListWindow from "@/components/CouponListWindow";
import AddressWindow from "@/components/AddressWindow"; import AddressWindow from "@/components/AddressWindow";
import { postOrderConfirm, postOrderComputed, createOrder } from "@/api/order"; import {
import { mapGetters } from "vuex"; postOrderConfirm,
import { handleOrderPayResults } from "@/libs/order"; postOrderComputed,
import { weappPay } from "@/libs/wechat"; createOrder
import { isWeixin, handleErrorMessage } from "@/utils"; } from "@/api/order";
import {
mapGetters
} from "vuex";
import {
handleOrderPayResults,
subscribeMessage
} from "@/libs/order";
import {
weappPay
} from "@/libs/wechat";
import {
isWeixin,
handleErrorMessage
} from "@/utils";
const NAME = "OrderSubmission", const NAME = "OrderSubmission",
_isWeixin = isWeixin(); _isWeixin = isWeixin();
export default { export default {
name: NAME, name: NAME,
components: { components: {
OrderGoods, OrderGoods,
CouponListWindow, CouponListWindow,
AddressWindow, AddressWindow,
},
props: {},
data: function () {
return {
offlinePayStatus: 2,
from: this.$deviceType,
deduction: true,
enableIntegral: true,
enableIntegralNum: 0,
isWeixin: _isWeixin,
pinkId: 0,
active: _isWeixin ? "weixin" : "yue",
showCoupon: false,
showAddress: false,
addressInfo: {},
couponId: 0,
orderGroupInfo: {
priceGroup: {},
},
usableCoupon: {},
addressLoaded: false,
useIntegral: false,
orderPrice: {
payPrice: "计算中",
},
mark: "",
systemStore: {},
shipping_type: 0,
contacts: "",
contactsTel: "",
storeSelfMention: 0,
cartid: "",
};
},
computed: mapGetters(["userInfo", "storeItems"]),
watch: {
useIntegral() {
this.computedPrice();
}, },
$yroute(n) { props: {},
if (n.name === NAME) this.getCartInfo(); data: function () {
return {
offlinePayStatus: 2,
from: this.$deviceType,
deduction: true,
enableIntegral: true,
enableIntegralNum: 0,
isWeixin: _isWeixin,
pinkId: 0,
active: _isWeixin ? "weixin" : "yue",
showCoupon: false,
showAddress: false,
addressInfo: {},
couponId: 0,
orderGroupInfo: {
priceGroup: {},
},
usableCoupon: {},
addressLoaded: false,
useIntegral: false,
orderPrice: {
payPrice: "计算中",
},
mark: "",
systemStore: {},
shipping_type: 0,
contacts: "",
contactsTel: "",
storeSelfMention: 0,
cartid: "",
};
}, },
shipping_type() { computed: mapGetters(["userInfo", "storeItems"]),
this.computedPrice(); watch: {
}, useIntegral() {
}, this.computedPrice();
onShow: function () { },
let that = this; $yroute(n) {
this.$store.dispatch("getUser", true); if (n.name === NAME) this.getCartInfo();
that.getCartInfo(); },
console.log(that.$yroute); shipping_type() {
if (that.$yroute.query.pinkid !== undefined) { this.computedPrice();
that.pinkId = that.$yroute.query.pinkid; },
}
if (that.$yroute.query.id !== undefined) {
that.cartid = that.$yroute.query.id;
console.log(that.cartid);
}
},
methods: {
showStoreList() {
this.$store.commit("get_to", "orders");
this.$yrouter.push({
path: "/pages/shop/StoreList/index",
});
}, },
addressType: function (index) { onShow: function () {
if (index && !this.systemStore.id) { let that = this;
uni.showToast({ this.$store.dispatch("getUser", true);
title: "暂无门店信息,您无法选择到店自提!", that.getCartInfo();
icon: "none", console.log(that.$yroute);
duration: 2000, if (that.$yroute.query.pinkid !== undefined) {
}); that.pinkId = that.$yroute.query.pinkid;
return; }
if (that.$yroute.query.id !== undefined) {
that.cartid = that.$yroute.query.id;
console.log(that.cartid);
} }
console.log(this);
this.shipping_type = index;
},
changeUseIntegral: function (e) {
// this.computedPrice();
this.useIntegral = e.mp.detail.value[0];
},
computedPrice() {
let shipping_type = this.shipping_type;
postOrderComputed(this.orderGroupInfo.orderKey, {
addressId: this.addressInfo.id,
useIntegral: this.useIntegral ? 1 : 0,
couponId: this.usableCoupon.id || 0,
shipping_type: parseInt(shipping_type) + 1,
}).then((res) => {
const data = res.data;
if (data.status === "EXTEND_ORDER") {
this.$yrouter.replace({
path: "/pages/order/OrderDetails/index",
query: {
id: data.result.orderId,
},
});
} else {
this.orderPrice = data.result;
}
});
}, },
getCartInfo() { methods: {
const cartIds = this.$yroute.query.id; showStoreList() {
if (!cartIds) { this.$store.commit("get_to", "orders");
uni.showToast({ this.$yrouter.push({
title: "参数有误", path: "/pages/shop/StoreList/index",
icon: "none",
duration: 2000,
}); });
return this.$yrouter.back(); },
} addressType: function (index) {
postOrderConfirm(cartIds) if (index && !this.systemStore.id) {
.then((res) => {
console.log(res, 999999);
console.log(res.data.systemStore || {}, 999999);
this.offlinePayStatus = res.data.offline_pay_status;
this.orderGroupInfo = res.data;
this.deduction = res.data.deduction;
this.usableCoupon = res.data.usableCoupon || {};
this.addressInfo = res.data.addressInfo || {};
//
this.systemStore = res.data.systemStore || {};
this.storeSelfMention = res.data.storeSelfMention;
this.computedPrice();
})
.catch(() => {
uni.showToast({ uni.showToast({
title: "加载订单数据失败", title: "暂无门店信息,您无法选择到店自提!",
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
return;
}
console.log(this);
this.shipping_type = index;
},
changeUseIntegral: function (e) {
// this.computedPrice();
this.useIntegral = e.mp.detail.value[0];
},
computedPrice() {
let shipping_type = this.shipping_type;
postOrderComputed(this.orderGroupInfo.orderKey, {
addressId: this.addressInfo.id,
useIntegral: this.useIntegral ? 1 : 0,
couponId: this.usableCoupon.id || 0,
shipping_type: parseInt(shipping_type) + 1,
}).then((res) => {
const data = res.data;
if (data.status === "EXTEND_ORDER") {
this.$yrouter.replace({
path: "/pages/order/OrderDetails/index",
query: {
id: data.result.orderId,
},
});
} else {
this.orderPrice = data.result;
}
}); });
}, },
addressTap: function () { getCartInfo() {
this.showAddress = true; const cartIds = this.$yroute.query.id;
if (!this.addressLoaded) { if (!cartIds) {
this.addressLoaded = true;
this.$refs.mychild.getAddressList();
}
},
addressRedirect() {
this.addressLoaded = false;
this.showAddress = false;
},
couponTap: function () {
this.showCoupon = true;
},
changeCoupon: function (coupon) {
if (!coupon) {
this.usableCoupon = {
couponTitle: "不使用优惠券",
id: 0,
};
} else {
this.usableCoupon = coupon;
}
this.computedPrice();
},
payItem: function (index) {
this.active = index;
},
changeAddress(addressInfo) {
this.addressInfo = addressInfo;
this.computedPrice();
},
createOrder() {
let shipping_type = this.shipping_type;
if (!this.active) {
uni.showToast({
title: "请选择支付方式",
icon: "none",
duration: 2000,
});
return;
}
if (!this.addressInfo.id && !this.shipping_type) {
uni.showToast({
title: "请选择收货地址",
icon: "none",
duration: 2000,
});
return;
}
if (this.shipping_type) {
if (
(this.contacts === "" || this.contactsTel === "") &&
this.shipping_type
) {
uni.showToast({ uni.showToast({
title: "请填写联系人或联系人电话", title: "参数有误",
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
return; return this.$yrouter.back();
} }
postOrderConfirm(cartIds)
if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(this.contactsTel)) { .then((res) => {
console.log(res, 999999);
console.log(res.data.systemStore || {}, 999999);
this.offlinePayStatus = res.data.offline_pay_status;
this.orderGroupInfo = res.data;
this.deduction = res.data.deduction;
this.usableCoupon = res.data.usableCoupon || {};
this.addressInfo = res.data.addressInfo || {};
//
this.systemStore = res.data.systemStore || {};
this.storeSelfMention = res.data.storeSelfMention;
this.computedPrice();
})
.catch(() => {
uni.showToast({
title: "加载订单数据失败",
icon: "none",
duration: 2000,
});
});
},
addressTap: function () {
this.showAddress = true;
if (!this.addressLoaded) {
this.addressLoaded = true;
this.$refs.mychild.getAddressList();
}
},
addressRedirect() {
this.addressLoaded = false;
this.showAddress = false;
},
couponTap: function () {
this.showCoupon = true;
},
changeCoupon: function (coupon) {
if (!coupon) {
this.usableCoupon = {
couponTitle: "不使用优惠券",
id: 0,
};
} else {
this.usableCoupon = coupon;
}
this.computedPrice();
},
payItem: function (index) {
this.active = index;
},
changeAddress(addressInfo) {
this.addressInfo = addressInfo;
this.computedPrice();
},
createOrder() {
let shipping_type = this.shipping_type;
if (!this.active) {
uni.showToast({ uni.showToast({
title: "请填写正确的手机号", title: "请选择支付方式",
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
return; return;
} }
if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(this.contacts)) { if (!this.addressInfo.id && !this.shipping_type) {
uni.showToast({ uni.showToast({
title: "请填写您的真实姓名", title: "请选择收货地址",
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
return; return;
} }
}
uni.showLoading({ if (this.shipping_type) {
title: "生成订单中", if (
}); (this.contacts === "" || this.contactsTel === "") &&
let from = {}; this.shipping_type
if (this.$deviceType == "app") { ) {
from.from = "app"; uni.showToast({
} title: "请填写联系人或联系人电话",
createOrder(this.orderGroupInfo.orderKey, { icon: "none",
realName: this.contacts, duration: 2000,
phone: this.contactsTel, });
addressId: this.addressInfo.id, return;
useIntegral: this.useIntegral ? 1 : 0, }
couponId: this.usableCoupon.id || 0,
payType: this.active, if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(this.contactsTel)) {
pinkId: this.pinkId, uni.showToast({
seckillId: this.orderGroupInfo.seckill_id, title: "请填写正确的手机号",
combinationId: this.orderGroupInfo.combination_id, icon: "none",
bargainId: this.orderGroupInfo.bargain_id, duration: 2000,
from: this.from, });
mark: this.mark || "", return;
shippingType: parseInt(shipping_type) + 1, }
storeId: this.storeItems ? this.storeItems.id : this.systemStore.id, if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(this.contacts)) {
...from, uni.showToast({
}) title: "请填写您的真实姓名",
.then((res) => { icon: "none",
uni.hideLoading(); duration: 2000,
handleOrderPayResults.call(this, res.data, "create"); });
}) return;
.catch((err) => { }
handleErrorMessage(err, "创建订单失败"); }
uni.showLoading({
title: "生成订单中",
}); });
let from = {};
if (this.$deviceType == "app") {
from.from = "app";
}
// #ifdef MP-WEIXIN
subscribeMessage()
// #endif
createOrder(this.orderGroupInfo.orderKey, {
realName: this.contacts,
phone: this.contactsTel,
addressId: this.addressInfo.id,
useIntegral: this.useIntegral ? 1 : 0,
couponId: this.usableCoupon.id || 0,
payType: this.active,
pinkId: this.pinkId,
seckillId: this.orderGroupInfo.seckill_id,
combinationId: this.orderGroupInfo.combination_id,
bargainId: this.orderGroupInfo.bargain_id,
from: this.from,
mark: this.mark || "",
shippingType: parseInt(shipping_type) + 1,
storeId: this.storeItems ? this.storeItems.id : this.systemStore.id,
...from,
})
.then((res) => {
uni.hideLoading();
handleOrderPayResults.call(this, res.data, "create", this.active);
})
.catch((err) => {
handleErrorMessage(err, "创建订单失败");
});
},
}, },
}, };
};
</script> </script>

6
pages/shop/StoreList/index.vue

@ -107,7 +107,11 @@ export default {
this.mapKey = res.data.mapKey; this.mapKey = res.data.mapKey;
}) })
.catch(err => { .catch(err => {
this.$dialog.error(err.msg); uni.showToast({
title: err.msg,
icon: "none",
duration: 2000,
});
}); });
} }
} }

609
pages/user/Recharge/index.vue

@ -15,23 +15,16 @@
</view> </view>
<view class="info-wrapper"> <view class="info-wrapper">
<view class="picList acea-row row-between mt-20"> <view class="picList acea-row row-between mt-20">
<view <view class="pic-box pic-box-color acea-row row-center-wrapper row-column"
class="pic-box pic-box-color acea-row row-center-wrapper row-column" :class="activePic === index ? 'pic-box-color-active' : ''" v-for="(item, index) in picList" :key="index"
:class="activePic === index ? 'pic-box-color-active' : ''" @click="picCharge(index, item)">
v-for="(item, index) in picList"
:key="index"
@click="picCharge(index, item)"
>
<view class="pic-number-pic"> <view class="pic-number-pic">
<text> <text>
{{ item.value.price }} {{ item.value.price }}
<text class="pic-number"></text> <text class="pic-number"></text>
</text> </text>
</view> </view>
<view <view class="pic-number" v-if="item.value.give_price > 0">赠送{{ item.value.give_price }} </view>
class="pic-number"
v-if="item.value.give_price > 0"
>赠送{{ item.value.give_price }} </view>
</view> </view>
<!-- <view <!-- <view
class="pic-box pic-box-color acea-row row-center-wrapper" class="pic-box pic-box-color acea-row row-center-wrapper"
@ -52,293 +45,335 @@
</view> </view>
</template> </template>
<script> <script>
import { mapGetters } from "vuex"; import {
import { weappPay } from "@/libs/wechat"; mapGetters
import { rechargeWechat, getRechargeApi } from "@/api/user"; } from "vuex";
import { add, sub } from "@/utils/bc"; import {
weappPay
} from "@/libs/wechat";
import {
rechargeWechat,
getRechargeApi
} from "@/api/user";
import {
add,
sub
} from "@/utils/bc";
import {
subscribeMessage
} from "@/libs/order";
export default { export default {
name: "Recharge", name: "Recharge",
components: {}, components: {},
props: {}, props: {},
data: function () { data: function () {
return { return {
active: 0, active: 0,
from: this.$deviceType, from: this.$deviceType,
money: "", money: "",
now_money: "", now_money: "",
picList: [], picList: [],
activePic: 0, activePic: 0,
numberPic: "", numberPic: "",
paid_price: "", paid_price: "",
rechar_id: 0, rechar_id: 0,
}; };
}, },
computed: mapGetters(["userInfo"]), computed: mapGetters(["userInfo"]),
mounted: function () { mounted: function () {
this.now_money = this.userInfo.nowMoney; this.now_money = this.userInfo.nowMoney;
this.getRecharge(); this.getRecharge();
}, },
methods: { methods: {
/** /**
* 充值额度选择 * 充值额度选择
*/ */
getRecharge() { getRecharge() {
getRechargeApi() getRechargeApi()
.then((res) => { .then((res) => {
this.picList = res.data.recharge_price_ways || []; this.picList = res.data.recharge_price_ways || [];
if (this.picList[0]) { if (this.picList[0]) {
this.rechar_id = this.picList[0].id; this.rechar_id = this.picList[0].id;
this.paid_price = this.picList[0].value.price; this.paid_price = this.picList[0].value.price;
this.numberPic = this.picList[0].value.give_price; this.numberPic = this.picList[0].value.give_price;
} }
}) })
.catch((res) => { .catch((res) => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000,
});
});
},
/**
* 选择金额
*/
picCharge(idx, item) {
this.activePic = idx;
if (idx == this.picList.length) {
this.rechar_id = 0;
this.paid_price = "";
this.numberPic = "";
} else {
this.money = "";
this.rechar_id = item.id;
this.paid_price = item.value.give_price;
this.numberPic = item.value.price;
}
},
recharge: function () {
let that = this,
price = Number(this.money);
if (this.picList.length == this.activePic && price === 0) {
uni.showToast({ uni.showToast({
title: title: "请输入您要充值的金额",
err.msg || err.response.data.msg || err.response.data.message,
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
}); return;
}, } else if (this.picList.length == this.activePic && price < 0.01) {
/**
* 选择金额
*/
picCharge(idx, item) {
this.activePic = idx;
if (idx == this.picList.length) {
this.rechar_id = 0;
this.paid_price = "";
this.numberPic = "";
} else {
this.money = "";
this.rechar_id = item.id;
this.paid_price = item.value.give_price;
this.numberPic = item.value.price;
}
},
recharge: function () {
let that = this,
price = Number(this.money);
if (this.picList.length == this.activePic && price === 0) {
uni.showToast({
title: "请输入您要充值的金额",
icon: "none",
duration: 2000,
});
return;
} else if (this.picList.length == this.activePic && price < 0.01) {
uni.showToast({
title: "充值金额不能低于0.01",
icon: "none",
duration: 2000,
});
return;
} else if (this.picList.length == this.activePic && price > 99999) {
uni.showToast({
title: "充值金额不能大于99999",
icon: "none",
duration: 2000,
});
return;
}
let prices = "",
paid_price = "";
if (price) {
prices = price;
paid_price = 0;
} else {
prices = that.numberPic;
paid_price = that.paid_price;
}
rechargeWechat({
price: prices,
from: that.from,
paid_price: paid_price,
rechar_id: that.rechar_id,
})
.then((res) => {
console.log(res);
var data = res.data.data;
weappPay(res.data.data)
.then(() => {
prices = add(prices, paid_price);
that.now_money = add(prices, parseFloat(that.userInfo.nowMoney));
uni.showToast({
title: "支付成功",
icon: "success",
duration: 2000,
});
this.$yrouter.back();
})
.finally((res) => {
//if(typeof(res) == "undefined") return
uni.showToast({
title: res,
icon: "none",
duration: 2000,
});
})
.catch(function () {
uni.showToast({
title: "支付失败",
icon: "none",
duration: 2000,
});
});
})
.catch((err) => {
console.log(err);
uni.showToast({ uni.showToast({
title: title: "充值金额不能低于0.01",
err.msg || err.response.data.msg || err.response.data.message,
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
}); return;
} else if (this.picList.length == this.activePic && price > 99999) {
uni.showToast({
title: "充值金额不能大于99999",
icon: "none",
duration: 2000,
});
return;
}
let prices = "",
paid_price = "";
if (price) {
prices = price;
paid_price = 0;
} else {
prices = that.numberPic;
paid_price = that.paid_price;
}
rechargeWechat({
price: prices,
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType,
paid_price: paid_price,
rechar_id: that.rechar_id,
})
.then((res) => {
console.log(res);
var data = res.data.data;
weappPay(res.data.data)
.then(() => {
prices = add(prices, paid_price);
that.now_money = add(prices, parseFloat(that.userInfo.nowMoney));
uni.showToast({
title: "支付成功",
icon: "success",
duration: 2000,
});
// #ifdef MP-WEIXIN
subscribeMessage()
// #endif
this.$yrouter.back();
})
.finally((res) => {
//if(typeof(res) == "undefined") return
uni.showToast({
title: res,
icon: "none",
duration: 2000,
});
})
.catch(function () {
uni.showToast({
title: "支付失败",
icon: "none",
duration: 2000,
});
});
})
.catch((err) => {
console.log(err);
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000,
});
});
},
}, },
}, };
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
#iframe { #iframe {
display: none; display: none;
} }
.pic-box-color-active {
background-color: #eb3729 !important; .pic-box-color-active {
color: #fff !important; background-color: #eb3729 !important;
} color: #fff !important;
.picList { }
margin-bottom: 0.3 * 100rpx;
margin-top: 0.3 * 100rpx; .picList {
} margin-bottom: 0.3 * 100rpx;
.font-color { margin-top: 0.3 * 100rpx;
color: #e83323; }
}
.recharge { .font-color {
border-radius: 0.1 * 100rpx; color: #e83323;
width: 100%; }
background-color: #fff;
margin: 0.2 * 100rpx auto 0 auto; .recharge {
padding: 0.3 * 100rpx; border-radius: 0.1 * 100rpx;
border-top-right-radius: 0.39 * 100rpx; width: 100%;
border-top-left-radius: 0.39 * 100rpx; background-color: #fff;
margin-top: -0.45 * 100rpx; margin: 0.2 * 100rpx auto 0 auto;
box-sizing: border-box; padding: 0.3 * 100rpx;
} border-top-right-radius: 0.39 * 100rpx;
.recharge .nav { border-top-left-radius: 0.39 * 100rpx;
height: 0.75 * 100rpx; margin-top: -0.45 * 100rpx;
line-height: 0.75 * 100rpx; box-sizing: border-box;
padding: 0 1 * 100rpx; }
}
.recharge .nav .item { .recharge .nav {
font-size: 0.3 * 100rpx; height: 0.75 * 100rpx;
color: #333; line-height: 0.75 * 100rpx;
} padding: 0 1 * 100rpx;
.recharge .nav .item.on { }
font-weight: bold;
border-bottom: 0.04 * 100rpx solid #e83323; .recharge .nav .item {
} font-size: 0.3 * 100rpx;
.recharge .info-wrapper { color: #333;
} }
.recharge .info-wrapper .money {
margin-top: 0.6 * 100rpx; .recharge .nav .item.on {
padding-bottom: 0.2 * 100rpx; font-weight: bold;
border-bottom: 1px dashed #ddd; border-bottom: 0.04 * 100rpx solid #e83323;
text-align: center; }
}
.recharge .info-wrapper .money span { .recharge .info-wrapper {}
font-size: 0.56 * 100rpx;
color: #333; .recharge .info-wrapper .money {
font-weight: bold; margin-top: 0.6 * 100rpx;
} padding-bottom: 0.2 * 100rpx;
.recharge .info-wrapper .money input { border-bottom: 1px dashed #ddd;
display: inline-block; text-align: center;
width: 3 * 100rpx; }
font-size: 0.84 * 100rpx;
text-align: center; .recharge .info-wrapper .money span {
color: #282828; font-size: 0.56 * 100rpx;
font-weight: bold; color: #333;
padding-right: 0.7 * 100rpx; font-weight: bold;
} }
.recharge .info-wrapper .money input::placeholder {
color: #ddd; .recharge .info-wrapper .money input {
} display: inline-block;
.recharge .info-wrapper .money input::-webkit-input-placeholder { width: 3 * 100rpx;
color: #ddd; font-size: 0.84 * 100rpx;
} text-align: center;
.recharge .info-wrapper .money input:-moz-placeholder { color: #282828;
color: #ddd; font-weight: bold;
} padding-right: 0.7 * 100rpx;
.recharge .info-wrapper .money input::-moz-placeholder { }
color: #ddd;
} .recharge .info-wrapper .money input::placeholder {
.recharge .info-wrapper .money input:-ms-input-placeholder { color: #ddd;
color: #ddd; }
}
.tip { .recharge .info-wrapper .money input::-webkit-input-placeholder {
font-size: 0.28 * 100rpx; color: #ddd;
color: #333333; }
font-weight: 800;
margin-bottom: 0.14 * 100rpx; .recharge .info-wrapper .money input:-moz-placeholder {
} color: #ddd;
.recharge .info-wrapper .tips span { }
color: #ef4a49;
} .recharge .info-wrapper .money input::-moz-placeholder {
.recharge .info-wrapper .pay-btn { color: #ddd;
display: block; }
width: 100%;
height: 0.86 * 100rpx; .recharge .info-wrapper .money input:-ms-input-placeholder {
margin: 0.5 * 100rpx auto 0 auto; color: #ddd;
line-height: 0.86 * 100rpx; }
text-align: center;
color: #fff; .tip {
border-radius: 0.5 * 100rpx; font-size: 0.28 * 100rpx;
font-size: 0.3 * 100rpx; color: #333333;
font-weight: bold; font-weight: 800;
} margin-bottom: 0.14 * 100rpx;
.payment-top { }
width: 100%;
height: 3.5 * 100rpx; .recharge .info-wrapper .tips span {
background-color: #eb3729; color: #ef4a49;
} }
.payment-top .name {
font-size: 0.26 * 100rpx; .recharge .info-wrapper .pay-btn {
color: rgba(255, 255, 255, 0.8); display: block;
margin-top: -0.38 * 100rpx; width: 100%;
margin-bottom: 0.3 * 100rpx; height: 0.86 * 100rpx;
} margin: 0.5 * 100rpx auto 0 auto;
.payment-top .pic { line-height: 0.86 * 100rpx;
font-size: 0.32 * 100rpx; text-align: center;
color: #fff; color: #fff;
} border-radius: 0.5 * 100rpx;
.payment-top .pic-font { font-size: 0.3 * 100rpx;
font-size: 0.78 * 100rpx; font-weight: bold;
color: #fff; }
}
.picList .pic-box { .payment-top {
width: 32%; width: 100%;
height: auto; height: 3.5 * 100rpx;
border-radius: 0.2 * 100rpx; background-color: #eb3729;
margin-top: 0.21 * 100rpx; }
padding: 0.2 * 100rpx 0;
} .payment-top .name {
.pic-box-color { font-size: 0.26 * 100rpx;
background-color: #f4f4f4; color: rgba(255, 255, 255, 0.8);
color: #656565; margin-top: -0.38 * 100rpx;
} margin-bottom: 0.3 * 100rpx;
.pic-number { }
font-size: 0.22 * 100rpx;
} .payment-top .pic {
.pic-number-pic { font-size: 0.32 * 100rpx;
font-size: 0.38 * 100rpx; color: #fff;
margin-right: 0.1 * 100rpx; }
text-align: center;
} .payment-top .pic-font {
.pic-box-money { font-size: 0.78 * 100rpx;
width: 100%; color: #fff;
display: block; }
}
.picList .pic-box {
width: 32%;
height: auto;
border-radius: 0.2 * 100rpx;
margin-top: 0.21 * 100rpx;
padding: 0.2 * 100rpx 0;
}
.pic-box-color {
background-color: #f4f4f4;
color: #656565;
}
.pic-number {
font-size: 0.22 * 100rpx;
}
.pic-number-pic {
font-size: 0.38 * 100rpx;
margin-right: 0.1 * 100rpx;
text-align: center;
}
.pic-box-money {
width: 100%;
display: block;
}
</style> </style>

25
pages/user/address/AddAddress/index.vue

@ -13,12 +13,7 @@
<view class="name">所在地区</view> <view class="name">所在地区</view>
<view class="picker acea-row row-between-wrapper select-value form-control"> <view class="picker acea-row row-between-wrapper select-value form-control">
<view class="address"> <view class="address">
<CitySelect <CitySelect ref="cityselect" :defaultValue="addressText" @callback="result" :items="district"></CitySelect>
ref="cityselect"
:defaultValue="addressText"
@callback="result"
:items="district"
></CitySelect>
</view> </view>
<view class="iconfont icon-dizhi font-color-red"></view> <view class="iconfont icon-dizhi font-color-red"></view>
</view> </view>
@ -47,7 +42,7 @@
</template> </template>
<script type="text/babel"> <script type="text/babel">
import CitySelect from "@/components/CitySelect"; import CitySelect from "@/components/CitySelect";
import { getAddress, postAddress, getCity } from "@/api/user"; import { getAddress, postAddress, getCity } from "@/api/user";
import attrs, { required, chs_phone } from "@/utils/validate"; import attrs, { required, chs_phone } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog"; import { validatorDefaultCatch } from "@/utils/dialog";
@ -89,7 +84,11 @@ export default {
that.ready = true; that.ready = true;
}) })
.catch(err => { .catch(err => {
that.$dialog.error(err.msg); uni.showToast({
title: err.msg,
icon: "none",
duration: 2000,
});
}); });
}, },
getUserAddress: function() { getUserAddress: function() {
@ -194,10 +193,10 @@ export default {
</script> </script>
<style lang="less"> <style lang="less">
.address { .address {
text { text {
width: 100%; width: 100%;
display: block; display: block;
}
} }
}
</style> </style>

253
pages/user/promotion/Poster/index.vue

@ -4,12 +4,7 @@
<swiper indicatorDots="true"> <swiper indicatorDots="true">
<block v-for="(item, infoIndex) in info" :key="infoIndex"> <block v-for="(item, infoIndex) in info" :key="infoIndex">
<swiper-item> <swiper-item>
<image <image class="slide-image" :src="item.wap_poster" mode="widthFix" show-menu-by-longpress />
class="slide-image"
:src="item.wap_poster"
mode="widthFix"
show-menu-by-longpress
/>
</swiper-item> </swiper-item>
</block> </block>
</swiper> </swiper>
@ -18,143 +13,143 @@
</view> </view>
</template> </template>
<script> <script>
// import { swiper, swiperSlide } from "vue-awesome-swiper"; // import { swiper, swiperSlide } from "vue-awesome-swiper";
import { getSpreadImg } from "@/api/user"; import {
getSpreadImg
} from "@/api/user";
export default { export default {
name: "Poster", name: "Poster",
components: { components: {
// swiper, // swiper,
// swiperSlide // swiperSlide
}, },
props: {}, props: {},
data: function() { data: function () {
return { return {
swiperPosters: { swiperPosters: {
speed: 1000, speed: 1000,
effect: "coverflow", effect: "coverflow",
slidesPerView: "auto", slidesPerView: "auto",
centeredSlides: true, centeredSlides: true,
coverflowEffect: { coverflowEffect: {
rotate: 0, // rotate: 0, //
stretch: -20, // stretch: -20, //
depth: 100, // depth: 100, //
modifier: 3, // modifier: 3, //
slideShadows: false // slideShadows: false //
},
observer: true,
observeParents: true
}, },
observer: true, info: [],
observeParents: true activeIndex: 0
}, };
info: [], },
activeIndex: 0 mounted: function () {
}; this.getIndex();
},
mounted: function() {
this.getIndex();
let that = this;
// this.swiper.on("slideChange", function() {
// that.activeIndex = that.swiper.activeIndex;
// });
},
computed: {
swiper() {
// return this.$refs.mySwiper.swiper;
}
},
methods: {
getIndex: function() {
let that = this; let that = this;
let from = {}; // this.swiper.on("slideChange", function() {
if (this.$deviceType == "app") { // that.activeIndex = that.swiper.activeIndex;
from.from = "app"; // });
},
computed: {
swiper() {
// return this.$refs.mySwiper.swiper;
} }
getSpreadImg(from).then(
res => {
that.info = res.data;
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
});
}
);
}, },
downloadIamge: function(imgsrc, name) { methods: {
var that = this; getIndex: function () {
this.isDown = true; let that = this;
var downloadUrl = imgsrc; getSpreadImg({
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType
}).then(
res => {
that.info = res.data;
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
}
);
},
downloadIamge: function (imgsrc, name) {
var that = this;
this.isDown = true;
var downloadUrl = imgsrc;
if (!wx.saveImageToPhotosAlbum) { if (!wx.saveImageToPhotosAlbum) {
uni.showModal({ uni.showModal({
title: "提示", title: "提示",
content: content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。"
"当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。" });
}); that.openDialogVisible = true;
that.openDialogVisible = true;
return; return;
} }
// wx.getSetting "scope.writePhotosAlbum" scope // wx.getSetting "scope.writePhotosAlbum" scope
wx.getSetting({ wx.getSetting({
success(res) { success(res) {
if (!res.authSetting["scope.writePhotosAlbum"]) { if (!res.authSetting["scope.writePhotosAlbum"]) {
that.openDialogVisible = true; that.openDialogVisible = true;
// //
wx.authorize({ wx.authorize({
scope: "scope.writePhotosAlbum", scope: "scope.writePhotosAlbum",
success() { success() {
that.downloadImage(downloadUrl); that.downloadImage(downloadUrl);
}, },
fail() { fail() {
// //
// //
wx.openSetting({ wx.openSetting({
success: function(data) {}, success: function (data) {},
fail: function(data) {} fail: function (data) {}
}); });
} }
}); });
} else { } else {
that.downloadImage(downloadUrl); that.downloadImage(downloadUrl);
}
},
fail(res) {
that.openDialogVisible = true;
} }
}, });
fail(res) { },
that.openDialogVisible = true; saveImg: function () {
} this.downloadIamge(
}); this.info[this.activeIndex].wap_poster,
}, "poster" + this.activeIndex
saveImg: function() { );
this.downloadIamge( }
this.info[this.activeIndex].wap_poster,
"poster" + this.activeIndex
);
} }
} };
};
</script> </script>
<style lang="less"> <style lang="less">
page { page {
height: 100%; height: 100%;
} }
.distribution-posters {
height: 100%; .distribution-posters {
} height: 100%;
}
.banenr { .banenr {
height: 100%; height: 100%;
} }
.banner swiper { .banner swiper {
height: 100%; height: 100%;
} }
.banner .slide-image { .banner .slide-image {
width: 100%; width: 100%;
height: auto; height: auto;
} }
</style> </style>

12
store/index.js

@ -100,7 +100,11 @@ const vuexStore = new Vuex.Store({
reslove(res.data); reslove(res.data);
}); });
}).catch(() => { }).catch(() => {
dialog.error("获取信息失败!"); uni.showToast({
title: "获取信息失败!",
icon: "none",
duration: 2000,
});
}); });
} }
}, },
@ -113,7 +117,11 @@ const vuexStore = new Vuex.Store({
}); });
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
dialog.error("获取信息失败!"); uni.showToast({
title: "获取信息失败!",
icon: "none",
duration: 2000,
});
}); });
}, },
changeLogin({ changeLogin({

Loading…
Cancel
Save