Commit 7e14accf authored by liwei's avatar liwei

修改了文件名称和位置

parent d1fdbe36
......@@ -27,7 +27,7 @@
}
},
{
"path" : "pages/tab/community",
"path" : "pages/tab/article",
"style" :
{
"navigationStyle": "custom",
......@@ -62,13 +62,13 @@
"root": "pagesNotice",
"pages": [
{
"path": "notice/list",
"path": "components/list",
"style": {
"navigationBarTitleText": "园区公告"
}
},
{
"path": "notice/detail",
"path": "components/detail",
"style": {
"navigationBarTitleText": "公告详情"
}
......@@ -346,7 +346,7 @@
"text": "活动"
},
{
"pagePath": "pages/tab/community",
"pagePath": "pages/tab/article",
"iconPath": "static/tab/sq.png",
"selectedIconPath": "static/tab/sqs.png",
"text": "动态"
......
......@@ -48,9 +48,9 @@
</template>
<script>
import ItemVue from '../components/Item.vue';
import ItemVue from '../../pagesArticle/components/Item.vue';
import empty from '@/components/empty.vue'
import ListVue from '../components/List.vue';
import ListVue from '../../pagesArticle/components/List.vue';
import login from '../../components/login/login.vue';
import ELM from '@/components/elm-toast/index.vue';
export default {
......
......@@ -25,7 +25,7 @@
<view class="leftline"></view>
<view class="title">{{notice.title}}</view>
<view class="rightline"></view>
<view class="notice-more" @click="gotopage('/pagesNotice/notice/list')">更多</view>
<view class="notice-more" @click="gotopage('/pagesNotice/components/list')">更多</view>
</view>
<!-- 热门推荐-->
<view class="recommendation-top">
......
<template>
<view class="activity-detail">
<view :class="show ? 'popupShow' : ''">
<view class="act-title">{{activityDetail.name}}</view>
<view class="act-body">
<!-- <view class="act-from">来源:龙韵文创园区</view> -->
<view class="act-time">{{activityDetail.activityBeginDate}}</view>
</view>
<view>
<view class="act-detail" v-html="activityDetail.activityDetails">
</view>
</view>
<view class="act-bottom" v-if="type!=='1'">
<view class="act-button" @click="open(activityDetail)">报名</view>
</view>
</view>
<!-- 报名弹窗 -->
<u-popup :show="show" @close="close" round="40">
<view class="popup-style">
<view class="popup-title">报名</view>
<view class="pop-body">
<view>
<image class="popbody-image" :src="baseURL+businessActivityDetail.imgUrl"/>
</view>
<view>
<view class="popbod-title">{{businessActivityDetail.name}}</view>
<view class="pop-time">
<image class="poptime-img" :src="baseURL+'static/images/日期.png'"/>
<view class="poptime-text">{{businessActivityDetail.activityBeginDate}}</view>
</view>
<view class="pop-price">
<image class="popprice-img" :src="baseURL+'static/images/单价.png'"/>
<view class="popprice-text">单价:<text>{{businessActivityDetail.price}}次/人</text></view>
</view>
</view>
</view>
<view class="buy-num">
<view class="buynum-title">购买数量</view>
<view class="buynum-math">
<image class="reduce" :src="baseURL+'static/images/减.png'" @click="reduce"/>
<view class="num">{{buynum}}</view>
<image class="add" :src="baseURL+'static/images/加.png'" @click="add"/>
</view>
</view>
<view class="usecoupon">
<view class="usecoupon-title">优惠券</view>
<view class="usecoupon-click" v-if="availablenum != 0 && discountamount==0"
@click="openavailablecoupon">
<text>{{availablenum}}</text>张可用
</view>
<view class="usecoupon-click" v-else-if="discountamount!==0" @click="openavailablecoupon">
-¥{{discountamount}}
</view>
<view class="usecoupon-click" v-else>
暂无可用优惠券
</view>
</view>
<view class="all-price">
<view class="all-money">共计:<text>{{totalprice}}</text></view>
<view class="all-button" @click="submitorder">确认支付</view>
</view>
</view>
</u-popup>
<!-- 优惠券详情 -->
<u-popup :show="show1" @close="close1" round="40">
<view class="couponpopup">
<view class="couponpopup-title">优惠券</view>
<view style="max-height: 50vh;overflow-y: scroll;">
<view class="coupon" v-for="item in couponList">
<view class="coupon-price" v-if="item.type === 0">
<text style="margin-top: 30rpx;"></text><text
style="font-size: 64rpx;">{{item.amount}}</text>
</view>
<view class="coupon-price" v-if="item.type === 1">
<text style="font-size: 64rpx;">{{item.discount}}</text><text
style="margin-top: 30rpx;"></text>
</view>
<view class="coupon-message">
<view class="message-left">
<view class="preferential">{{item.name}}</view>
<view class="preferential-time" v-if="item.useType === 1">
{{ dateFormat(item.useEndTime) }}前可用
</view>
<view class="preferential-time" v-else>领取后{{item.limitTime}}天内有效</view>
</view>
<view class="message-right">
<view class="right-button" @click="receive(item)">领取</view>
</view>
</view>
</view>
</view>
</view>
</u-popup>
<!-- 可用优惠券弹窗 -->
<u-popup :show="show2" @close="close2" round="40">
<view class="couponpopup">
<view class="couponpopup-title">可使用优惠券</view>
<u-radio-group v-model="radiovalue1" placement="column" iconPlacement="right" size="36">
<u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in availablecouponList"
:key="index" :label="item.name" :name="item.businessId" label-size="36" size="36"
activeColor="#D84848" @change="changecoupon(item)">
</u-radio>
</u-radio-group>
<view class="couponpopup-button">
<view class="all-button" @click="cancel">取消</view>
<view class="all-button" @click="submit(item)">确定</view>
</view>
</view>
</u-popup>
<!-- 是否使用折扣券弹出框 -->
<u-modal :show="show3" @confirm="confirm" ref="uModal" :content="content" :showCancelButton="true"
@cancel="usecancel"></u-modal>
</view>
</template>
<script>
import {activitydetail} from "../../api/activity/index.js"
import {
queryDetailById,
busActivityList,
couponList,
receivedcoupon,
claimcoupons,
memberdiscount,
addorder,
pay,
updateorderstatus
} from '../../api/business/index.js'
export default {
data() {
return {
baseURL: 'http://localhost:8088/idea/file/',
show: false,
show1: false, // 是否显示优惠券弹窗
show2: false, // 是否显示可用优惠券弹窗
show3: false,
id: '',
activityDetail: '',
type: '',
businessActivityDetail: {}, //活动详情
couponList: [], //优惠券列表
coupon: {}, // 商家活动显示的优惠券数据
activityId: '', // 活动id
buynum: 1, // 购买数量
totalprice: 0, //总价
availablenum: 0, // 可用优惠券的数量
availablecouponList: [], // 可用优惠券列表
radiovalue1: '',
couponname: '', // 优惠券名称
couponid: '', // 优惠券id
discountamount: 0, // 优惠金额
content: '', //优惠券折扣
memberdiscount: 1, //会员折扣
couponvalue: {}
}
},
onLoad(options) {
this.id = JSON.parse(options.id)
if (options != null) {
this.id = JSON.parse(decodeURIComponent(options.id))
console.log("传参的id", this.id)
this.type = decodeURIComponent(options.type)
console.log("传参的type", this.type)
}
this.getActivityDetail()
},
methods: {
// 获取活动详情
getActivityDetail(){
activitydetail(this.id).then(res=>{
console.log("活动详情",res)
this.activityDetail =res.data
// 处理图片样式问题
this.activityDetail.activityDetails = res.data.activityDetails.replace(/\<img/gi,
'<img style="max-width:100%;height:auto;border-radius: 12px 12px 12px 12px;" ')
})
},
// 领取优惠券
receive(row) {
claimcoupons(row.businessId).then(res => {
if (res.code === 200) {
uni.showToast({
title: '领取成功',
icon: 'success'
})
this.show1 = false
this.getCouponList()
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
// 查询已领取优惠券
getReceivedcoupon() {
const params = {
activityId: this.activityId,
num: this.buynum
}
receivedcoupon(params).then(res => {
console.log("已领取优惠券", res)
this.availablenum = res.total
this.availablecouponList = res.rows
})
},
// 查询优惠券列表
getCouponList() {
const query = {
storeId: this.id
}
couponList(query).then(res => {
console.log("优惠券列表", res)
this.couponList = res.rows
this.coupon = res.rows[0]
})
},
// 打开优惠券弹窗
opencoupon() {
this.show1 = true
},
// 打开报名弹窗
open(data) {
this.show = true
this.businessActivityDetail = data
this.activityId = data.businessId
this.getReceivedcoupon()
this.getMemberdiscount()
this.countprice()
},
// 查询会员折扣
getMemberdiscount() {
memberdiscount().then(res => {
console.log("会员折扣", res)
if (res.data !== 100) {
const num1 = '0.' + res.data // 会员折扣
this.memberdiscount = parseFloat(num1)
this.memberdiscount = this.memberdiscount.toFixed(2)
} else {
this.memberdiscount = 1
}
console.log("会员折扣的值", this.memberdiscount)
})
},
// 打开可使用优惠券的弹窗
openavailablecoupon() {
this.show = false
this.show2 = true
this.discountamount = 0
},
// 可使用优惠券弹窗取消按钮
cancel() {
this.show = true
this.show2 = false
this.discountamount = 0
this.radiovalue1 = ''
},
// 可使用优惠券弹窗提交按钮
submit(preson) {
this.show = true
this.show2 = false
this.countprice()
},
// 提交订单
submitorder() {
const ordermessage = {
goodsId: this.activityId,
num: this.buynum,
couponId: this.couponid,
type: this.businessActivityDetail.activityType
}
// 添加订单
addorder(ordermessage).then(res => {
console.log('添加订单', res)
const activityId = this.activityId
if (res.code === 200) {
const orderid = res.data.businessId
// 支付
const payquery = {
orderId: orderid,
activityId: this.activityId
}
pay(payquery).then(res => {
console.log("测试支付", res)
if (res.errMsg === 'OK') {
if (!res.data.nonceStr) {
uni.showToast({
title: '下单失败,请稍后重试',
icon: 'none'
})
} else {
uni.requestPayment({
provider: "wxpay",
appId: res.data.appid, // 微信小程序appid
timeStamp: res.data.timeStamp, // 时间戳
nonceStr: res.data.nonceStr, // 随机字符串
package: res.data.package,
signType: "MD5", // 签名算法
paySign: res.data.paySign, // 签名
success(res) {
uni.showToast({
title: '支付成功',
icon: 'success'
})
uni.navigateTo({
url:'/pages/mine/myorder/index'
})
},
fail(e) {
uni.showToast({
title: '支付已取消',
icon: 'none'
})
// const activityId = this.activityId
const orderStatus = {
orderId: orderid,
activityId: activityId
}
// 修改订单状态为待支付
updateorderstatus(orderStatus).then(res=>{
console.log('修改订单状态',res)
})
}
});
}
} else {
uni.showToast({
title: '下单失败',
icon: 'none'
})
}
})
} else if(res.code !== 200){
console.log("到这")
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
// 选择优惠券
changecoupon(value) {
console.log("数据===", value)
this.couponvalue = value
this.couponname = value.name
this.couponid = value.businessId
if (value.type === 0) {
this.discountamount = value.amount
} else if (value.type === 1) {
this.show2 = false
this.show3 = true
this.content = '会员折扣和优惠券折扣不能同时享用,是否确认使用该折扣券?'
}
},
// 确认按钮,若用户点击确认,则使用优惠券折扣
confirm() {
this.show2 = true
this.show3 = false
const num = '0.' + this.couponvalue.discount
const num1 = parseFloat(num)
// const num2 = num1.toFixed(2)
const num2 = (1 - num1) * this.totalprice
this.discountamount = num2.toFixed(2)
},
// 取消按钮,若用户点击取消,则使用会员折扣
usecancel() {
this.show3 = false
this.cancel()
},
// 计算总价
countprice() {
const price1 = this.businessActivityDetail.price * this.buynum - this.discountamount // 满减券优惠后的总金额
this.totalprice = price1 * this.memberdiscount
console.log("总价钱", this.totalprice)
},
// 关闭报名弹窗
close() {
this.show = false
},
// 关闭优惠券弹窗
close1() {
this.show1 = false
},
// 关闭可使用优惠券弹窗
close2() {
this.show2 = false
},
// 加购买数量
add() {
this.buynum = this.buynum + 1
this.getReceivedcoupon()
this.countprice()
},
// 减购买数量
reduce() {
this.buynum = this.buynum - 1
if (this.buynum < 1) {
this.buynum = 1
}
this.getReceivedcoupon()
this.countprice()
}
}
}
</script>
<style lang="scss" scoped>
.activity-detail {
background: #FFFFFF;
min-height: 100vh;
padding: 64rpx 34rpx 192rpx 34rpx;
.act-title {
font-size: 24px;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #222222;
padding-bottom: 42rpx;
border-bottom: 1px solid #ECECEC;
}
.act-body {
display: flex;
justify-content: space-between;
margin: 42rpx 0 60rpx 0;
.act-from {
font-size: 14px;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #848484;
}
.act-time {
font-size: 14px;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #848484;
}
}
.act-detail {
padding-bottom: 24rpx;
width: 100%;
overflow: hidden;
}
.act-bottom {
background: #FFFFFF;
width: 100vw;
height: 192rpx;
display: flex;
justify-content: center;
align-items: center;
padding: 0 34rpx;
position: fixed;
bottom: 0;
margin: 0 -34rpx;
.act-button {
width: 100%;
height: 44px;
background: #BD1A2D;
border-radius: 22px 22px 22px 22px;
color: #FFFFFF;
font-size: 34rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
display: flex;
justify-content: center;
align-items: center;
line-height: 34rpx;
}
}
.popup-style {
// height: 566rpx;
padding: 0 34rpx 0 42rpx;
.popup-title{
font-size: 18px;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
text-align: center;
margin: 42rpx 0 62rpx 0;
}
.pop-body{
display: flex;
padding-bottom: 42rpx;
border-bottom: 1px solid #EEEEEE;
.popbody-image{
width: 208rpx;
height: 208rpx;
border-radius: 12px 12px 12px 12px;
margin-right: 26rpx;
}
.popbod-title{
font-size: 16px;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #222222;
margin-bottom: 26rpx;
height: 76rpx;
}
.pop-time{
display: flex;
margin-bottom: 24rpx;
align-items: center;
.poptime-img{
width: 24rpx;
height: 24rpx;
margin-right: 14rpx;
}
.poptime-text{
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #666666;
line-height: 28rpx;
}
}
.pop-price{
display: flex;
align-items: center;
.popprice-img{
width: 24rpx;
height: 24rpx;
margin-right: 14rpx;
}
.popprice-text{
font-size: 12px;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #666666;
text{
color: #D84848;
}
}
}
}
.buy-num {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 44rpx;
padding-bottom: 108rpx;
border-bottom: 1px solid #EEEEEE;
.buynum-title {
font-size: 32rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #444444;
line-height: 32rpx;
}
.buynum-math {
display: flex;
align-items: center;
.reduce {
width: 36rpx;
height: 36rpx;
margin-right: 48rpx;
}
.num {
font-size: 16px;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #444444;
margin-right: 48rpx;
}
.add {
width: 36rpx;
height: 36rpx;
}
}
}
.all-price{
height: 192rpx;
display: flex;
justify-content: space-between;
align-items: center;
.all-money{
font-size: 16px;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
text{
color: #D94343;
}
}
.all-button{
width: 328rpx;
height: 88rpx;
background: #BD1A2D;
border-radius: 22px 22px 22px 22px;
font-size: 34rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
line-height: 34rpx;
}
}
}
.popupShow {
padding-right: 34rpx;
overflow: hidden;
position: fixed;
}
.usecoupon {
display: flex;
justify-content: space-between;
height: 100rpx;
align-items: center;
border-bottom: 1px solid #EEEEEE;
.usecoupon-title {
font-size: 32rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #444444;
}
.usecoupon-click {
color: #666;
text {
color: #D84848;
}
}
}
}
.couponpopup {
background-color: #FFFFFF;
padding: 40rpx;
border-radius: 40px 40px 0 0;
// max-height: 60vh;
// overflow-y: scroll;
.couponpopup-title {
font-size: 18px;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
text-align: center;
padding-bottom: 40rpx;
}
.couponpopup-button {
display: flex;
justify-content: space-between;
margin-top: 40rpx;
}
}
.all-button {
width: 328rpx;
height: 88rpx;
background: #BD1A2D;
border-radius: 22px 22px 22px 22px;
font-size: 34rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
line-height: 34rpx;
}
</style>
......@@ -62,7 +62,7 @@
},
gotopage(item){
uni.navigateTo({
url: '/pagesNotice/notice/detail?id='+item.businessId
url: '/pagesNotice/components/detail?id='+item.businessId
})
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment