Browse Source

增加积分商城的功能

zyh
Gaoxs 4 years ago
parent
commit
6d4fe7f4cb
  1. 4
      components/OrderGoods.vue
  2. 8
      pages/order/MyOrder/index.vue
  3. 155
      pages/order/OrderDetails/index.vue
  4. 40
      pages/order/OrderSubmission/index.vue
  5. 27
      pages/shop/GoodsCon/index.vue

4
components/OrderGoods.vue

@ -15,7 +15,8 @@
class="attr line1"
v-if="cart.productInfo.attrInfo"
>{{ cart.productInfo.attrInfo.sku }}</view>
<view class="money font-color-red">{{ cart.truePrice }}</view>
<view class="money font-color-red" v-if="!isIntegral">{{ cart.truePrice }}</view>
<view class="money font-color-red" v-if="isIntegral">{{ cart.productInfo.attrInfo.integral }}积分</view>
<view class="evaluate" v-if="evaluate == 3 && cart.isReply==0" @click="routerGo(cart)">评价</view>
</view>
</view>
@ -26,6 +27,7 @@
export default {
name: "OrderGoods",
props: {
isIntegral:Boolean,
evaluate: Number,
cartInfo: {
type: Array,

8
pages/order/MyOrder/index.vue

@ -90,13 +90,16 @@
<view class="text acea-row row-between">
<view class="name line2">{{ cart.productInfo.storeName }}</view>
<view class="money">
<view>
<view v-if="order.payType!='integral'">
{{
cart.productInfo.attrInfo
? cart.productInfo.attrInfo.price
: cart.productInfo.price
}}
</view>
<view v-if="order.payType=='integral'">
{{order.payIntegral}}积分
</view>
<view>x{{ cart.cartNum }}</view>
</view>
</view>
@ -104,7 +107,8 @@
</view>
<view class="totalPrice">
{{ order.cartInfo.length || 0 }}件商品总金额
<text class="money font-color-red">{{ order.payPrice }}</text>
<text class="money font-color-red" v-if="order.payType!='integral'">{{ order.payPrice }}</text>
<text class="money font-color-red" v-if="order.payType=='integral'">{{order.payIntegral}}积分</text>
</view>
<view class="bottom acea-row row-right row-middle">
<template v-if="order._status._type == 0">

155
pages/order/OrderDetails/index.vue

@ -18,67 +18,44 @@
<view :class="{ on: status.type === 4 }">已完成</view>
</view>
<view class="progress acea-row row-between-wrapper">
<view
class="iconfont"
:class="[
<view class="iconfont" :class="[
status.type === 0 || status.type === 9
? 'icon-webicon318'
: 'icon-yuandianxiao',
status.type >= 0 ? 'font-color-red' : ''
]"
></view>
]"></view>
<view class="line" :class="{ 'bg-color-red': status.type > 0 && status.type != 9 }"></view>
<view
class="iconfont"
:class="[
<view class="iconfont" :class="[
status.type === 1 ? 'icon-webicon318' : 'icon-yuandianxiao',
status.type >= 1 && status.type != 6 && status.type != 9
? 'font-color-red'
: ''
]"
></view>
<view
class="line"
:class="{'bg-color-red':status.type > 1 && status.type != 6 && status.type != 9}"
v-if="orderInfo.shippingType === 1"
></view>
<view
class="iconfont"
]"></view>
<view class="line" :class="{'bg-color-red':status.type > 1 && status.type != 6 && status.type != 9}"
v-if="orderInfo.shippingType === 1"></view>
<view class="iconfont"
:class="[status.type === 2 ? 'icon-webicon318' : 'icon-yuandianxiao',status.type >= 2 && status.type != 6 && status.type != 9? 'font-color-red': '']"
v-if="orderInfo.shippingType === 1"
></view>
<view
class="line"
:class="{
v-if="orderInfo.shippingType === 1"></view>
<view class="line" :class="{
'bg-color-red':
status.type > 2 && status.type != 6 && status.type != 9
}"
></view>
<view
class="iconfont"
:class="[
}"></view>
<view class="iconfont" :class="[
status.type === 3 ? 'icon-webicon318' : 'icon-yuandianxiao',
status.type >= 3 && status.type != 6 && status.type != 9
? 'font-color-red'
: ''
]"
></view>
<view
class="line"
:class="{
]"></view>
<view class="line" :class="{
'bg-color-red':
status.type > 3 && status.type != 6 && status.type != 9
}"
></view>
<view
class="iconfont"
:class="[
}"></view>
<view class="iconfont" :class="[
status.type == 4 ? 'icon-webicon318' : 'icon-yuandianxiao',
status.type >= 4 && status.type != 6 && status.type != 9
? 'font-color-red'
: ''
]"
></view>
]"></view>
</view>
</view>
<div class="writeOff" v-if="orderInfo.shippingType === 2 && orderInfo.paid === 1">
@ -110,15 +87,9 @@
</div>
</div>
</div>
<div
class="map acea-row row-between-wrapper"
v-if="orderInfo.shippingType === 2 && orderInfo.paid === 1"
>
<div class="map acea-row row-between-wrapper" v-if="orderInfo.shippingType === 2 && orderInfo.paid === 1">
<div>自提地址信息</div>
<div
class="place cart-color acea-row row-center-wrapper"
@click="showChang(orderInfo.systemStore)"
>
<div class="place cart-color acea-row row-center-wrapper" @click="showChang(orderInfo.systemStore)">
<span class="iconfont icon-weizhi"></span>查看位置
</div>
</div>
@ -134,7 +105,8 @@
<div class="name">
{{ system_store.name}}
<span class="phone">{{ system_store.phone }}</span>
<span @click="telPhone(system_store.phone)" class="iconfont icon-tonghua font-color-red" :href="'tel:' + system_store.phone"></span>
<span @click="telPhone(system_store.phone)" class="iconfont icon-tonghua font-color-red"
:href="'tel:' + system_store.phone"></span>
</div>
<div>{{ system_store.address }}</div>
</div>
@ -142,7 +114,7 @@
<image src="@/static/images/line.jpg" />
</view>
</template>
<OrderGoods :evaluate="status.type || 0" :cartInfo="orderInfo.cartInfo || []"></OrderGoods>
<OrderGoods :evaluate="status.type || 0" isIntegral :cartInfo="orderInfo.cartInfo || []"></OrderGoods>
<view class="wrapper">
<view class="item acea-row row-between">
<view>订单编号</view>
@ -223,10 +195,14 @@
</view>
</view>
<view class="wrapper">
<view class="item acea-row row-between">
<view class="item acea-row row-between" v-if="!isIntegral">
<view>支付金额</view>
<view class="conter">{{ orderInfo.totalPrice }}</view>
</view>
<view class="item acea-row row-between" v-if="isIntegral">
<view>支付积分</view>
<view class="conter">{{ orderInfo.payIntegral }}积分</view>
</view>
<view class="item acea-row row-between" v-if="orderInfo.couponPrice > 0">
<view>优惠券抵扣</view>
<view class="conter">-{{ orderInfo.couponPrice }}</view>
@ -241,7 +217,8 @@
</view>
<view class="actualPay acea-row row-right">
实付款
<text class="money font-color-red">{{ orderInfo.payPrice }}</text>
<text class="money font-color-red" v-if="!isIntegral">{{ orderInfo.payPrice }}</text>
<text class="money font-color-red" v-if="isIntegral">{{ orderInfo.payIntegral }}积分</text>
</view>
</view>
<view style="height:100rpx;" v-if="!refundOrder && offlineStatus"></view>
@ -255,26 +232,19 @@
</template>
<!-- -->
<template v-if="orderInfo.shippingType == 1 && status.type == 2">
<view
class="bnt default"
@click="$yrouter.push({ path: '/pages/order/Logistics/index' ,query:{id:orderInfo.orderId }})"
>查看物流</view>
<view class="bnt default"
@click="$yrouter.push({ path: '/pages/order/Logistics/index' ,query:{id:orderInfo.orderId }})">查看物流</view>
<view class="bnt bg-color-red" @click="takeOrder">确认收货</view>
</template>
<template v-if="orderInfo.shippingType == 1 && status.type == 3 && orderInfo.deliveryType == 'express'">
<view
class="bnt default"
@click="$yrouter.push({ path: '/pages/order/Logistics/index' ,query:{id:orderInfo.orderId }})"
>查看物流</view>
<view class="bnt default"
@click="$yrouter.push({ path: '/pages/order/Logistics/index' ,query:{id:orderInfo.orderId }})">查看物流</view>
</template>
<template v-if="orderInfo.shippingType == 1 && status.type == 4">
<view class="bnt cancel" @click="delOrder">删除订单</view>
<view
class="bnt default"
@click="
<view class="bnt default" @click="
$yrouter.push({ path: '/pages/order/Logistics/index' ,query:{id:orderInfo.orderId }})
"
>查看物流</view>
">查看物流</view>
</template>
<template v-if="status.type == 6">
<view class="bnt bg-color-red" @click="goGroupRule(orderInfo)">查看拼团</view>
@ -282,23 +252,25 @@
</view>
<Payment v-model="pay" :types="payType" @checked="toPay" :balance="userInfo.nowMoney"></Payment>
<view class="geoPage" v-if="mapShow">
<iframe
width="100%"
height="100%"
frameborder="0"
scrolling="no"
:src="'https://apis.map.qq.com/uri/v1/geocoder?coord=' + system_store.latitude + ',' +system_store.longitude +'&referer=' +mapKey"
></iframe>
<iframe width="100%" height="100%" frameborder="0" scrolling="no"
:src="'https://apis.map.qq.com/uri/v1/geocoder?coord=' + system_store.latitude + ',' +system_store.longitude +'&referer=' +mapKey"></iframe>
</view>
</view>
</template>
<script>
import OrderGoods from "@/components/OrderGoods";
import { orderDetail } from "@/api/order";
import {
orderDetail
} from "@/api/order";
import Payment from "@/components/Payment";
import { isWeixin, copyClipboard } from "@/utils";
import { mapGetters } from "vuex";
import {
isWeixin,
copyClipboard
} from "@/utils";
import {
mapGetters
} from "vuex";
import {
cancelOrderHandle,
takeOrderHandle,
@ -332,6 +304,7 @@ export default {
system_store: {},
mapKay: "",
mapShow: false,
isIntegral: false
};
},
computed: {
@ -439,15 +412,17 @@ export default {
},
getOrderStatus: function () {
let orderInfo = this.orderInfo || {},
_status = orderInfo._status || { _type: 0 },
_status = orderInfo._status || {
_type: 0
},
status = {};
let type = parseInt(_status._type),
delivery_type = orderInfo.deliveryType,
seckill_id = orderInfo.seckillId ? parseInt(orderInfo.seckillId) : 0,
bargain_id = orderInfo.bargainId ? parseInt(orderInfo.bargainId) : 0,
combination_id = orderInfo.combinationId
? parseInt(orderInfo.combinationId)
: 0;
combination_id = orderInfo.combinationId ?
parseInt(orderInfo.combinationId) :
0;
status = {
type: type,
class_status: 0,
@ -497,6 +472,12 @@ export default {
this.orderTypeName = "秒杀订单";
this.orderTypeNameStatus = false;
}
this.isIntegral = res.data.payType == 'integral'
if (this.isIntegral) {
this.orderTypeName = "积分兑换订单";
this.orderTypeNameStatus = false;
}
this.system_store = res.data.systemStore || {};
this.mapKey = res.data.mapKay;
this.setOfflinePayStatus(this.orderInfo.offlinePayStatus);
@ -527,11 +508,13 @@ export default {
top: 0;
z-index: 10000;
}
.order-details .writeOff {
background-color: #fff;
margin-top: 0.13 * 100rpx;
padding-bottom: 0.3 * 100rpx;
}
.order-details .writeOff .title {
font-size: 0.3 * 100rpx;
color: #282828;
@ -540,6 +523,7 @@ export default {
padding: 0 0.3 * 100rpx;
line-height: 0.87 * 100rpx;
}
.order-details .writeOff .grayBg {
background-color: #f2f5f7;
width: 5.9 * 100rpx;
@ -548,26 +532,31 @@ export default {
margin: 0.5 * 100rpx auto 0 auto;
padding-top: 0.55 * 100rpx;
}
.order-details .writeOff .grayBg .pictrue {
width: 2.9 * 100rpx;
height: 2.9 * 100rpx;
margin: 0 auto;
}
.order-details .writeOff .grayBg .pictrue img {
width: 100%;
height: 100%;
display: block;
}
.order-details .writeOff .gear {
width: 5.9 * 100rpx;
height: 0.3 * 100rpx;
margin: 0 auto;
}
.order-details .writeOff .gear img {
width: 100%;
height: 100%;
display: block;
}
.order-details .writeOff .num {
background-color: #f0c34c;
width: 5.9 * 100rpx;
@ -579,32 +568,39 @@ export default {
text-align: center;
padding-top: 0.04 * 100rpx;
}
.order-details .writeOff .rules {
margin: 0.46 * 100rpx 0.3 * 100rpx 0 0.3 * 100rpx;
border-top: 0.01 * 100rpx solid #f0f0f0;
padding-top: 0.1 * 100rpx;
}
.order-details .writeOff .rules .item {
margin-top: 0.15 * 100rpx;
}
.order-details .writeOff .rules .item .rulesTitle {
font-size: 0.28 * 100rpx;
color: #282828;
}
.order-details .writeOff .rules .item .rulesTitle .iconfont {
font-size: 0.3 * 100rpx;
color: #333;
margin-right: 0.08 * 100rpx;
margin-top: 0.05 * 100rpx;
}
.order-details .writeOff .rules .item .info {
font-size: 0.28 * 100rpx;
color: #999;
margin-top: 0.05 * 100rpx;
}
.order-details .writeOff .rules .item .info .time {
margin-left: 0.2 * 100rpx;
}
.order-details .map {
height: 0.86 * 100rpx;
font-size: 0.3 * 100rpx;
@ -615,6 +611,7 @@ export default {
background-color: #fff;
padding: 0 0.3 * 100rpx;
}
.order-details .map .place {
font-size: 0.26 * 100rpx;
width: 1.76 * 100rpx;
@ -623,12 +620,14 @@ export default {
line-height: 0.5 * 100rpx;
text-align: center;
}
.order-details .map .place .iconfont {
font-size: 0.27 * 100rpx;
height: 0.27 * 100rpx;
line-height: 0.27 * 100rpx;
margin: 0.02 * 100rpx 0.03 * 100rpx 0 0;
}
.order-details .address .name .iconfont {
font-size: 0.34 * 100rpx;
margin-left: 0.1 * 100rpx;

40
pages/order/OrderSubmission/index.vue

@ -44,9 +44,9 @@
<image src="@/static/images/line.jpg" />
</view>
</view>
<OrderGoods :evaluate="0" :cartInfo="orderGroupInfo.cartInfo"></OrderGoods>
<OrderGoods :evaluate="0" isIntegral :cartInfo="orderGroupInfo.cartInfo"></OrderGoods>
<view class="wrapper">
<view class="item acea-row row-between-wrapper" @click="couponTap" v-if="deduction === false">
<view class="item acea-row row-between-wrapper" @click="couponTap" v-if="deduction === false && !isIntegral">
<view>优惠券</view>
<view class="discount">
{{ usableCoupon.couponTitle || "请选择" }}
@ -65,7 +65,7 @@
当前积分
<text class="num font-color-red">{{ userInfo.integral || 0 }}</text>
</text>
<checkbox value="true" :checked="useIntegral ? true : false"></checkbox>
<checkbox value="true" v-if="!isIntegral" :checked="useIntegral ? true : false"></checkbox>
</label>
</checkbox-group>
</view>
@ -101,7 +101,7 @@
<textarea v-model="mark"></textarea>
</view>
</view>
<view class="wrapper">
<view class="wrapper" v-if="!isIntegral">
<view class="item">
<view>支付方式</view>
<view class="list">
@ -131,17 +131,18 @@
<view class="moneyList">
<view class="item acea-row row-between-wrapper" v-if="orderPrice.totalPrice !== undefined">
<view>商品总价</view>
<view class="money">{{ orderPrice.totalPrice }}</view>
<view class="money" v-if="!isIntegral">{{ orderPrice.totalPrice }}</view>
<view class="money" v-if="isIntegral">{{ orderPrice.payIntegral }}积分</view>
</view>
<view class="item acea-row row-between-wrapper" v-if="orderPrice.payPostage > 0">
<view class="item acea-row row-between-wrapper" v-if="orderPrice.payPostage > 0 && !isIntegral">
<view>运费</view>
<view class="money">{{ orderPrice.payPostage }}</view>
</view>
<view class="item acea-row row-between-wrapper" v-if="orderPrice.couponPrice > 0">
<view class="item acea-row row-between-wrapper" v-if="orderPrice.couponPrice > 0 && !isIntegral">
<view>优惠券抵扣</view>
<view class="money">-{{ orderPrice.couponPrice }}</view>
</view>
<view class="item acea-row row-between-wrapper" v-if="orderPrice.deductionPrice > 0">
<view class="item acea-row row-between-wrapper" v-if="orderPrice.deductionPrice > 0 && !isIntegral">
<view>积分抵扣</view>
<view class="money">-{{ orderPrice.deductionPrice }}</view>
</view>
@ -150,7 +151,8 @@
<view class="footer acea-row row-between-wrapper">
<view>
合计:
<text class="font-color-red">{{ orderPrice.payPrice }}</text>
<text class="font-color-red" v-if="!isIntegral">{{ orderPrice.payPrice }}</text>
<text class="font-color-red" v-if="isIntegral">{{ orderPrice.payIntegral }}积分</text>
</view>
<view class="settlement" @click="createOrder">立即结算</view>
</view>
@ -324,6 +326,7 @@
contactsTel: "",
storeSelfMention: 0,
cartid: "",
isIntegral: false
};
},
computed: mapGetters(["userInfo", "storeItems"]),
@ -346,6 +349,8 @@
if (that.$yroute.query.pinkid !== undefined) {
that.pinkId = that.$yroute.query.pinkid;
}
this.isIntegral = that.$yroute.query.isIntegral == 'true'
this.useIntegral = this.isIntegral
if (that.$yroute.query.id !== undefined) {
that.cartid = that.$yroute.query.id;
console.log(that.cartid);
@ -372,6 +377,9 @@
},
changeUseIntegral: function (e) {
// this.computedPrice();
if (this.isIntegral) {
return
}
this.useIntegral = e.mp.detail.value[0];
},
computedPrice() {
@ -460,8 +468,20 @@
this.computedPrice();
},
createOrder() {
if (this.isIntegral) {
//
if (this.userInfo.integral < this.orderPrice.payIntegral) {
uni.showToast({
title: "积分不足",
icon: "none",
duration: 2000,
});
return
}
this.active = 'integral'
}
let shipping_type = this.shipping_type;
if (!this.active) {
if (!this.isIntegral && !this.active) {
uni.showToast({
title: "请选择支付方式",
icon: "none",

27
pages/shop/GoodsCon/index.vue

@ -7,7 +7,7 @@
<!-- 商品信息描述 -->
<view class="wrapper">
<view class="share acea-row row-between row-bottom">
<view class="money font-color-red">
<view class="money font-color-red" v-if="!isIntegral">
<text></text>
<text class="num">{{
attr.productSelect.price || storeInfo.price
@ -16,11 +16,16 @@
v-if="storeInfo.vipPrice && storeInfo.vipPrice > 0">{{ attr.productSelect.vipPrice || storeInfo.vipPrice }}</text>
<image src="@/static/images/vip.png" class="image" v-if="storeInfo.vipPrice && storeInfo.vipPrice > 0" />
</view>
<view class="money font-color-red" v-if="isIntegral">
<text class="num">{{
attr.productSelect.integral || storeInfo.integral
}}积分</text>
</view>
<view class="iconfont icon-fenxiang" @click="listenerActionSheet"></view>
</view>
<view class="introduce">{{ storeInfo.storeName }}</view>
<view class="label acea-row row-between-wrapper">
<text>原价:{{ storeInfo.otPrice }}</text>
<text v-if="!isIntegral">原价:{{ storeInfo.otPrice }}</text>
<text>库存:{{ storeInfo.stock }}{{ storeInfo.unitName }}</text>
<text>销量:{{ storeInfo.sales }}{{ storeInfo.unitName }}</text>
</view>
@ -311,7 +316,7 @@
qqmapsdk: null,
productConClass: "product-con",
tempName: "全国包邮",
isIntegral: "false"
isIntegral: false
};
},
computed: mapGetters(["isLogin", "location"]),
@ -331,6 +336,7 @@
} else {
this.id = this._route.query.id;
}
this.isIntegral = url.isIntegral == 'true'
this.productCon();
this.setOpenShare();
},
@ -507,6 +513,7 @@
this.$set(this.attr.productSelect, "price", productSelect.price);
this.$set(this.attr.productSelect, "stock", productSelect.stock);
this.$set(this.attr.productSelect, "unique", productSelect.unique);
this.$set(this.attr.productSelect, "integral", productSelect.integral);
this.$set(this.attr.productSelect, "cart_num", 1);
this.$set(this, "attrValue", value.sort().join(","));
this.$set(this, "attrTxt", "已选择");
@ -518,6 +525,7 @@
);
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
this.$set(this.attr.productSelect, "price", this.storeInfo.price);
this.$set(this.attr.productSelect, "integral", this.storeInfo.integral);
this.$set(this.attr.productSelect, "stock", 0);
this.$set(this.attr.productSelect, "unique", "");
this.$set(this.attr.productSelect, "cart_num", 0);
@ -532,6 +540,7 @@
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
this.$set(this.attr.productSelect, "price", this.storeInfo.price);
this.$set(this.attr.productSelect, "stock", this.storeInfo.stock);
this.$set(this.attr.productSelect, "integral", this.storeInfo.integral);
this.$set(
this.attr.productSelect,
"unique",
@ -632,12 +641,14 @@
this.$set(this.attr.productSelect, "price", productSelect.price);
this.$set(this.attr.productSelect, "stock", productSelect.stock);
this.$set(this.attr.productSelect, "unique", productSelect.unique);
this.$set(this.attr.productSelect, "integral", productSelect.integral);
this.$set(this.attr.productSelect, "cart_num", 1);
this.$set(this, "attrValue", res.value);
this.$set(this, "attrTxt", "已选择");
} else {
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
this.$set(this.attr.productSelect, "price", this.storeInfo.price);
this.$set(this.attr.productSelect, "integral", this.storeInfo.price);
this.$set(this.attr.productSelect, "stock", 0);
this.$set(this.attr.productSelect, "unique", "");
this.$set(this.attr.productSelect, "cart_num", 0);
@ -698,11 +709,11 @@
cartNum: that.attr.productSelect.cart_num,
new: news,
uniqueId: that.attr.productSelect !== undefined ?
that.attr.productSelect.unique :
"",
that.attr.productSelect.unique : "",
};
postCartAdd(q)
.then(function (res) {
console.log(res)
that.isOpen = false;
that.attr.cartAttr = false;
if (news) {
@ -718,6 +729,7 @@
path: "/pages/order/OrderSubmission/index",
query: {
id: res.data.cartId,
isIntegral:that.isIntegral
},
});
} else {
@ -732,9 +744,12 @@
}
})
.catch((error) => {
console.log(error)
that.isOpen = false;
uni.showToast({
title: error.response.data.msg,
title: error.msg ||
error.response.data.msg ||
error.response.data.message,
icon: "none",
duration: 2000,
});

Loading…
Cancel
Save