第一次提交

This commit is contained in:
wangxiaowei
2025-06-11 10:21:51 +08:00
commit 52932d54b1
2341 changed files with 185283 additions and 0 deletions

View File

@ -0,0 +1,247 @@
<template>
<view class="prodcut-list-wrap" :data-theme="theme()" :class="theme() || ''">
<view class="top-tabbar">
<view :class="type == 0 ? 'tab-item active' : 'tab-item'" @click="stateFunc(0)">全部</view>
<view :class="type == 1 ? 'tab-item active' : 'tab-item'" @click="stateFunc(1)">实物</view>
<view :class="type == 2 ? 'tab-item active' : 'tab-item'" @click="stateFunc(2)">虚拟</view>
</view>
<view class="list">
<view class="item" v-for="(item, index) in listData" :key="index">
<view>
<view class="f28">{{ item.record_name }}</view>
<view class="f24 gray9">{{ item.create_time }}</view>
</view>
<button class="btn-red record-list-btn"
@click="gotoPage('/pages/plus/lottery/receive?record_id=' + item.record_id)"
v-if="item.status == 0">
未领取
</button>
<button v-else class="btn-gray record-list-btn">
<span v-if="item.prize_type!=3">已领取</span>
<span v-if="item.prize_type==3&&item.delivery_status == 10">待发货</span>
<span v-if="item.prize_type==3&&item.delivery_status == 20">已发货</span>
</button>
</view>
</view>
<!-- 没有记录 -->
<view class="d-c-c p30" v-if="listData.length == 0 && !loading">
<text class="iconfont icon-wushuju"></text>
<text class="cont">亲,暂无相关记录哦</text>
</view>
<uni-load-more v-else :loadingType="loadingType"></uni-load-more>
</view>
</template>
<script>
import uniLoadMore from '@/components/uni-load-more.vue';
export default {
components: {
uniLoadMore
},
data() {
return {
/*是否加载完成*/
loading: true,
/*数据列表*/
listData: [],
/*最后一页码数*/
last_page: 0,
/*当前页面*/
page: 1,
/*每页条数*/
list_rows: 10,
no_more: false,
type: 0
};
},
onShow() {
this.page = 1;
this.listData = [];
this.getData();
},
computed: {
/*加载中状态*/
loadingType() {
if (this.loading) {
return 1;
} else {
if (this.listData.length != 0 && this.no_more) {
return 2;
} else {
return 0;
}
}
}
},
onReachBottom() {
let self = this;
if (self.page < self.last_page) {
self.page++;
self.getData();
}
self.no_more = true;
},
methods: {
stateFunc(n) {
if (this.type == n || this.loading) {
return;
}
this.type = n;
this.page = 1;
this.listData = [];
this.getData();
},
/*获取数据*/
getData() {
let self = this;
self.loading = true;
self._post(
'plus.lottery.lottery/record', {
page: self.page || 1,
list_rows: self.list_rows,
type: self.type
},
function(res) {
self.loading = false;
if (res.data.list.data != null) {
self.listData = self.listData.concat(res.data.list.data);
}
self.last_page = res.data.list.last_page;
if (self.last_page <= 1) {
self.no_more = true;
}
}
);
}
}
};
</script>
<style lang="scss">
.point_top {
position: relative;
width: 750rpx;
height: 240rpx;
display: flex;
justify-content: center;
align-items: center;
}
.point_top image {
position: absolute;
width: 750rpx;
height: 240rpx;
z-index: 0;
}
.prodcut-list-wrap .list {
background: #ffffff;
padding-left: 20rpx;
margin: 20rpx;
border-radius: 25rpx;
padding: 0 20rpx;
}
.ponit_title {
padding-top: 40rpx;
}
.prodcut-list-wrap {}
.prodcut-list-wrap .list .item {
padding: 30rpx 0;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #dddddd;
}
.prodcut-list-wrap .list .item:last-child {
border: none;
}
.prodcut-list-wrap .product-cover,
.prodcut-list-wrap .product-cover image {
width: 150rpx;
height: 150rpx;
border-radius: 12rpx;
}
.prodcut-list-wrap .product-info {
flex: 1;
margin-left: 26rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.prodcut-list-wrap .product-title {
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
font-size: 32rpx;
width: 380rpx;
}
.prodcut-list-wrap .price {
color: #f6220c;
font-size: 20rpx;
line-height: 28rpx;
}
.prodcut-list-wrap .price .num {
padding: 0 4rpx;
font-size: 36rpx;
}
.prodcut-list-wrap .already-sale {
color: #999;
font-size: 26rpx;
margin-bottom: 18rpx;
}
.prodcut-list-wrap .already-sale .btn-red {
line-height: 2;
font-size: 28rpx;
}
.point_btn {
width: 120rpx;
height: 50rpx;
background: linear-gradient(90deg, #7b45ff 0%, #961eff 100%);
border-radius: 25rpx;
font-size: 26rpx;
color: #ffffff;
line-height: 50rpx;
text-align: center;
margin-right: 30rpx;
}
.point_btn.btn-gray {
background: #cccccc;
color: #ffffff;
}
.record-list-btn {
width: 160rpx;
font-size: 26rpx;
color: #ffffff;
text-align: center;
line-height: 56rpx;
height: 56rpx;
background: #cccccc;
border-radius: 28rpx;
border-radius: 32rpx;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
}
.record-list-btn.btn-red {
background-color: #FE5F5B;
color: #FFFFFF;
border: none;
}
</style>

View File

@ -0,0 +1,649 @@
<template>
<view class="bg-lottery pr" :style="'background-image: url(' + bg_image + ');'">
<view class="d-b-c top-box ww100">
<view class="d-s-c">
<image class="lottery-points" src="/static/icon/lottery-points.png" mode=""></image>
<text class="yellow f28">账户{{ points_name() }}</text>
<text class="white f36 ml10">{{ user_points }}</text>
</view>
<view class="points-rule" @click="isRule = true">活动规则</view>
</view>
<view class="rule-title">
<view class="tc mt20 f28">每次抽奖消耗 {{ points }} {{ points_name() }},今日剩余{{ times }}</view>
</view>
<view class="lottery-title">
<almost-lottery
:prizeList="prizeList"
:prizeIndex="prizeIndex"
:lotteryBg="'/uni_modules/almost-lottery/static/almost-lottery/almost-lottery__bg.png'"
:actionBg="'/uni_modules/almost-lottery/static/almost-lottery/almost-lottery__action.png'"
@reset-index="prizeIndex = -1"
@draw-start="handleDrawStart"
@draw-end="handleDrawEnd"
@finish="handleDrawFinish"
v-if="prizeList.length"
/>
</view>
<view class="ww100 mb23 mt40">
<button type="default" class="record" @click="gotoPage('/pages/plus/lottery/WinningRecord')">
中奖记录
<text class="icon iconfont icon-bofang"></text>
</button>
</view>
<view class="content">
<swiper class="swiper" vertical circular autoplay interval="2000" display-multiple-items="5">
<swiper-item v-for="(item, index) in listData" :key="index">
<view class="box">
<view class="text-ellipsis">{{ item.showText }}</view>
</view>
</swiper-item>
</swiper>
</view>
<popup :show="isPopup" type="middle" backgroundColor="#ea564c" :padding="40" :width="638" @hidePopup="hidePopup">
<view class="pr ww100 tc mb38">
<view class="pop-tit-line"></view>
<view class="pop-tit-text">恭喜中奖啦</view>
</view>
<view class="d-c-c d-c ww100 product-box pr">
<view class="circular-left"></view>
<view class="circular-right"></view>
<view></view>
<view class="pop_img"><image :src="result.image" mode=""></image></view>
<view class="targetLink" v-if="result.type == 3" @click="gotoPage('/pages/plus/lottery/WinningRecord')">
<view class="f26 text-ellipsis fb">{{ result.name }}</view>
</view>
<view class="" v-else>
<view class="f26 text-ellipsis fb">{{ result.name }}</view>
</view>
</view>
</popup>
<popup :show="isRule" :width="575" :heigth="550" :padding="0" @hidePopup="isRule = false" backgroundColor="none">
<view class="pop-center">
<image class="bg-rule" src="/static/invite/bg-rule.png" mode=""></image>
<view class="pop-title">活动规则</view>
<scroll-view scroll-y="true" style="height: 473rpx;">
<view class="pop-title-box">{{ content }}</view>
</scroll-view>
</view>
</popup>
</view>
</template>
<script>
import popup from '@/components/uni-popup.vue';
import AlmostLottery from '@/uni_modules/almost-lottery/components/almost-lottery/almost-lottery.vue';
import uniLoadMore from '@/components/uni-load-more.vue';
export default {
components: {
AlmostLottery,
popup,
uniLoadMore
},
data() {
return {
loading: true,
finish: false,
times: 0,
points: '',
user_points: '',
bg_image: '',
content: '',
// 以下是奖品配置数据
// 奖品数据
prizeList: [],
// 奖品是否设有库存
onStock: true,
// 中奖下标
prizeIndex: -1,
result: {},
listData: [],
/*样式*/
styleValue: '',
/*当前角标*/
index_num: 0,
/*高度*/
lineHeight: 0,
/*最大数*/
maxSize: 0,
/*时间*/
timer: null,
isPopup: false,
isRecord: false,
recordList: [],
list_rows: 10,
last_page: 0,
/*当前页面*/
page: 1,
/*没有更多*/
no_more: false,
isRule: false
};
},
computed: {
/*加载中状态*/
loadingType() {
if (this.loading) {
return 1;
} else {
if (this.recordList.length != 0 && this.no_more) {
return 2;
} else {
return 0;
}
}
}
},
onShow() {
this.isRecord = false;
this.restoreData();
this.handleInitCanvas();
},
methods: {
/*初始化*/
init() {
let self = this;
if (this.listData.length > 1) {
uni.getSystemInfo({
success(res) {
self.lineHeight = (res.windowWidth / 750) * 60;
self.maxSize = self.listData.length;
self.timer = setInterval(function() {
self.animation();
}, 3000);
}
});
}
},
/*动画*/
animation() {
let self = this;
self.index_num++;
if (self.index_num >= self.maxSize) {
self.index_num = 0;
}
this.styleValue = -self.lineHeight * self.index_num;
},
async getPrizeList() {
uni.showLoading({
title: '奖品准备中...'
});
this.loading = true;
// 等待接口返回的数据进一步处理
let res = await this.requestApiGetPrizeList();
if (res.ok) {
let data = res.data;
if (data.length) {
this.prizeList = data;
}
} else {
uni.hideLoading();
uni.showToast({
title: '获取奖品失败'
});
}
},
requestApiGetPrizeList() {
let self = this;
return new Promise((resolve, reject) => {
self._post('plus.lottery.Lottery/getLottery', {}, function(res) {
self.loading = false;
self.bg_image = res.data.data.file_path;
self.content = res.data.data.content;
self.prizeList = res.data.data.prize;
self.listData = res.data.recordList;
self.listData.forEach((item, index) => {
let num = self.GetDateDiff(item.create_time);
let user = item.user ? item.user.nickName : '匿名用户';
item.showText = num + user + '抽中了' + item.record_name;
});
self.times = res.data.nums;
self.points = res.data.data.points;
self.user_points = res.data.data.user_points;
self.init();
resolve({
ok: true,
data: self.prizeList
});
});
});
},
GetDateDiff(startTime) {
var t2 = startTime; //格式不正确需要转换
var aftert2 = new Date(t2.replace(/-/g, '/'));
var data = new Date();
let times = data.getTime() - aftert2.getTime();
var days = parseInt(times / (24 * 1000 * 3600)); //计算相差的天数
var leave = times % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
var h = parseInt(leave / (3600 * 1000)); //计算小时数
//计算分钟数
var h_leave = leave % (3600 * 1000);
var min = parseInt(h_leave / (60 * 1000));
//计算秒数
var min_leave = h_leave % (60 * 1000);
var sec = parseInt(min_leave / 1000);
let text = '';
if (days > 0) {
text = `${days}天前`;
}else if (h > 0) {
text = `${h}小时前`;
}else if (min > 0) {
text = `${min}分钟前`;
}else{
text = `${sec}秒前`;
}
console.log(days);
return text;
},
// 重新生成
handleInitCanvas() {
this.prizeList = [];
this.getPrizeList();
},
// 本次抽奖开始
handleDrawStart() {
console.log('start');
let self = this;
if (self.loading || !self.finish) {
return;
}
if (self.times <= 0) {
self.showError('次数不足');
return;
}
self.loading = true;
self._post(
'plus.lottery.Lottery/draw',
{},
function(res) {
self.times--;
self.loading = false;
self.result = res.data.result;
let list = [...self.prizeList];
let prizeId = res.data.result.prize_id;
for (let i = 0; i < list.length; i++) {
let item = list[i];
if (item.prize_id === prizeId) {
// 中奖下标
self.prizeIndex = i;
break;
}
}
console.log('本次抽中奖品 =>', self.prizeList[self.prizeIndex].name);
},
function(err) {
self.loading = false;
}
);
},
hidePopup() {
this.isPopup = false;
},
hideRecordPopup() {
this.isRecord = false;
},
// 本次抽奖结束
handleDrawEnd() {
this.isPopup = true;
this.handleInitCanvas();
// 完成抽奖后,这里处理你拿到结果后的逻辑
},
// 抽奖转盘绘制完成
handleDrawFinish(res) {
this.finish = true;
// 抽奖转盘准备就绪后,这里处理你的逻辑
// console.log('抽奖转盘绘制完成', res)
},
/*还原初始化*/
restoreData() {
this.recordList = [];
this.page = 1;
this.no_more = false;
this.last_page = 1;
},
getList() {
let self = this;
self.loading = true;
self._post(
'plus.lottery.Lottery/record',
{
list_rows: self.list_rows,
page: self.page || 1
},
function(res) {
self.loading = false;
self.recordList = self.recordList.concat(res.data.list.data);
self.last_page = res.data.list.last_page;
if (res.data.list.last_page <= 1) {
self.no_more = true;
}
}
);
},
getRecord() {
this.restoreData();
this.getList();
this.isRecord = true;
},
/*可滚动视图区域到底触发*/
scrolltolowerFunc() {
let self = this;
self.page++;
self.loading = true;
if (self.page > self.last_page) {
self.loading = false;
self.no_more = true;
return;
}
self.getList();
}
}
};
</script>
<style lang="scss">
.bg-lottery {
width: 750rpx;
min-height: 1843rpx;
background-size: 750rpx 1843rpx;
background-position: 0 0;
overflow: hidden;
}
.rule-title {
font-size: 26rpx;
margin: 0 auto;
width: 640rpx;
margin-top: 287rpx;
color: #ffffff;
}
.rule-title-t {
background-color: #ee1413;
border-radius: 12rpx;
height: 80rpx;
line-height: 80rpx;
width: 400rpx;
padding: 25rpx 35rpx;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
margin: 0 auto;
}
.lottery-title {
padding-top: 30rpx;
position: relative;
z-index: 1;
}
.lottery-base {
position: relative;
z-index: 0;
margin-top: -6rpx;
margin-bottom: 80rpx;
}
.base-image {
width: 424rpx;
height: 186rpx;
margin: 0 auto;
}
.btn-image {
position: absolute;
left: 0;
right: 0;
margin: 0 auto;
bottom: -48rpx;
width: 262rpx;
height: 130rpx;
}
button.record {
width: 252rpx;
height: 64rpx;
background: #ffc519;
border: 1px solid #ff840a;
box-shadow: 0rpx 6rpx 5rpx 0rpx rgba(0, 0, 0, 0.12);
border-radius: 32rpx;
padding: 0;
color: #956746;
font-size: 26rpx;
margin: 0 auto;
display: flex;
justify-content: center;
align-items: center;
}
.record .icon.icon-bofang {
font-size: 22rpx;
color: #956746;
margin-left: 10rpx;
}
.ruler-box {
box-sizing: border-box;
width: 678rpx;
margin: 0 auto;
background: #ffffff;
border-radius: 12rpx;
padding: 20rpx 45rpx;
}
.special-box {
width: 678rpx;
height: 60rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 22rpx;
padding: 0 64rpx;
box-sizing: border-box;
margin: 60rpx auto;
}
.special-content {
width: 551rpx;
font-size: 30rpx;
font-family: Source Han Sans CN;
font-weight: 500;
color: #e8573c;
flex: 1;
margin: 0 auto;
overflow: hidden;
}
.special-content-list {
transition: transform 0.4s;
}
.content-item {
height: 60rpx;
line-height: 60rpx;
}
.special-content.display_1 {
height: 60rpx;
}
.pop_img {
width: 130rpx;
height: 130rpx;
margin-bottom: 20rpx;
image {
width: 130rpx;
height: 130rpx;
}
}
.pop-record-line {
background-color: #333333;
width: 245rpx;
height: 1rpx;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
z-index: -1;
}
.pop-record-text {
color: #333333;
font-size: 28rpx;
background-color: #ffffff;
display: inline;
padding: 0 12rpx;
}
.pop-tit-line {
background-color: #f5ddc1;
width: 472rpx;
height: 2rpx;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
z-index: -1;
}
.pop-tit-text {
color: #f5ddc1;
font-size: 52rpx;
background-color: #ea564c;
display: inline;
padding: 0 16rpx;
}
.product-box {
border-radius: 24rpx;
background-color: #ffffff;
padding: 45rpx 0;
}
.circular-right {
width: 44rpx;
height: 44rpx;
border-radius: 50%;
background-color: #ea564c;
position: absolute;
top: 0;
bottom: 0;
margin: auto 0;
right: -22rpx;
}
.circular-left {
width: 44rpx;
height: 44rpx;
border-radius: 50%;
background-color: #ea564c;
position: absolute;
top: 0;
bottom: 0;
margin: auto 0;
left: -22rpx;
}
.record-box {
padding-bottom: 70rpx;
}
.record-list-btn {
width: 96rpx;
height: 40rpx;
line-height: 40rpx;
font-size: 22rpx;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
padding: 0;
margin-left: 16rpx;
}
.targetLink {
text-decoration: underline;
color: #ea564c;
}
.top-box {
position: absolute;
top: 30rpx;
z-index: 2;
}
.lottery-points {
width: 56rpx;
height: 56rpx;
margin-right: 14rpx;
flex-shrink: 0;
margin-left: 20rpx;
}
.points-rule {
width: 175rpx;
height: 64rpx;
background: #ffc519;
border-radius: 31rpx 0 0 31rpx;
color: #956746;
font-size: 28rpx;
line-height: 64rpx;
text-align: center;
}
.yellow {
color: #ffc519;
}
.pop-center {
position: relative;
width: 575rpx;
height: 550rpx;
}
.pop-title {
position: relative;
height: 77rpx;
line-height: 77rpx;
color: #ffffff;
font-size: 28rpx;
text-align: center;
z-index: 1;
}
.pop-title-box {
padding: 78rpx 52rpx 20rpx 42rpx;
white-space: pre-line;
color: #7f685a;
font-size: 26rpx;
line-height: 46rpx;
}
.bg-rule {
width: 575rpx;
height: 550rpx;
position: absolute;
left: 0;
top: 0;
z-index: 0;
}
.swiper {
width: 660rpx;
/* 高度跟自己需要的子元素更改我这里是显示3个每个50rpx 所以是150rpx */
height: 300rpx;
margin: 50rpx auto;
}
.box {
color: #ffffff;
font-size: 24rpx;
line-height: 1.2;
height: 60rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10rpx;
}
</style>

View File

@ -0,0 +1,68 @@
<template>
<div>
<!--地址-->
<view class="add-address d-s-c" @click="addAddress()" v-if="Address==null">
<view class="icon-box mr10">
<span class="icon iconfont icon-dizhi1"></span>
</view>
<text>请添加收货地址</text>
</view>
<view class="address-defalut-wrap" v-else>
<view class="info">
<text class="state">默认</text>
<text class="type">家</text>
<text class="province-c-a">{{Address.region.province}} {{Address.region.city}} {{Address.region.region}} </text>
</view>
<view class="address">
<text class="fb gray3">{{Address.detail}}</text>
<view class="icon-box" @click="addAddress()">
<span class="icon iconfont icon-jiantou"></span>
</view>
</view>
<view class="user">
<text class="name">{{Address.name}}</text>
<text class="tel">{{Address.phone}}</text>
</view>
</view>
<view class="addree-bottom">
<view class="stripe" v-for="(item,index) in 10" :key="index">
<text :class="index%2==0?'red':'blue'"></text>
<text class="white"></text>
</view>
</view>
</div>
</template>
<script>
export default{
data(){
return {
}
},
props: ['Address','exist_address'],
onLoad() {
},
mounted() {
},
methods:{
/*添加地址*/
addAddress(){
let url = '/pages/user/address/address?source=order';
if(!this.exist_address){
url = '/pages/user/address/add/add';
}
this.gotoPage(url);
}
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,422 @@
<template>
<view :class="Visible?'product-popup open':'product-popup close'" @touchmove.stop.prevent="" @click="closePopup">
<view class="popup-bg"></view>
<view class="main" v-on:click.stop>
<view class="header">
<image :src="form.show_sku.sku_image" mode="aspectFit" class="avt"></image>
<view class="">{{ selectSpec }}</view>
<view class="close-btn" @click="closePopup">
<text class="icon iconfont icon-guanbi"></text>
</view>
</view>
<view class="body">
<!--规格-->
<view>
<scroll-view scroll-y="true" class="specs mt20" style="max-height: 600rpx;"
v-if="form.specData !=null">
<view class="specs mt20" v-for="(item_attr,attr_index) in form.specData.spec_attr"
:key="attr_index">
<view class="specs-hd p-20-0">
<text class="f24 gray9">{{item_attr.group_name}}</text>
<text class="ml10 red" v-if="form.productSpecArr[attr_index]==null">
请选择{{item_attr.group_name}}
</text>
</view>
<view class="specs-list">
<button type="primary" :class="item.checked ? 'btn-red' : 'btn-gray-border'"
v-for="(item,item_index) in item_attr.spec_items" :key="item_index"
@click="selectAttr(attr_index, item_index)">{{item.spec_value}}
</button>
</view>
</view>
</scroll-view>
</view>
</view>
<view class="btns">
<button type="primary" class="confirm-btn" @click="closePopup()">选好了</button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
/*是否可见*/
Visible: false,
/*表单对象*/
form: {
detail: {
},
show_sku: {
sku_image: ''
}
},
/*当前商品总库存*/
stock: 0,
/*选择提示*/
selectSpec: '',
/*是否打开过多规格选择框*/
isOpenSpec: false,
type: ''
}
},
props: ['isPopup', 'productModel'],
onLoad() {
},
mounted() {
},
computed: {
/*判断增加数量*/
isadd: function() {
return this.form.show_sku.sum >= this.stock || this.form.show_sku.sum >= this.form.detail.limit_num;
},
/*判断减少数量*/
issub: function() {
return this.form.show_sku.sum <= 1;
}
},
watch: {
'isPopup': function(n, o) {
if (n != o) {
this.Visible = n;
this.form = this.productModel;
this.initShowSku();
this.form.type = this.productModel.type;
}
},
'form.specData': {
handler(n, o) {
let str = '',
select = '';
this.isAll = true;
if (n) {
for (let i = 0; i < n.spec_attr.length; i++) {
if (this.form.productSpecArr[i] == null) {
this.isAll = false;
str += n.spec_attr[i].group_name + ' ';
} else {
n.spec_attr[i].spec_items.forEach(item => {
if (this.form.productSpecArr[i] == item.item_id) {
select += '\"' + item.spec_value + '\" ';
}
});
}
}
if (!this.isAll) {
str = '请选择: ' + str;
} else {
select = '已选: ' + select;
}
}
this.selectSpec = this.isAll ? select : str;
},
deep: true,
immediate: true
}
},
methods: {
/*初始化*/
initShowSku() {
this.form.show_sku.sku_image = this.form.detail.image[0].file_path;
this.form.show_sku.product_price = this.form.detail.product_price;
this.form.show_sku.product_sku_id = 0;
this.form.show_sku.line_price = this.form.detail.line_price;
this.form.show_sku.stock_num = this.form.detail.product_stock;
this.form.show_sku.sum = 1;
this.stock = this.form.detail.product_stock;
},
/*选择属性*/
selectAttr(attr_index, item_index) {
let self = this;
let items = self.form.specData.spec_attr[attr_index].spec_items;
let curItem = items[item_index];
if (curItem.checked) {
// curItem.checked = false;
self.$set(self.form.specData.spec_attr[attr_index].spec_items[item_index],'checked',false);
self.form.productSpecArr[attr_index] = null;
} else {
for (let i = 0; i < items.length; i++) {
self.$set(self.form.specData.spec_attr[attr_index].spec_items[i],'checked',false);
}
self.$set(self.form.specData.spec_attr[attr_index].spec_items[item_index],'checked',true);
self.form.productSpecArr[attr_index] = curItem.item_id;
}
for (let i = 0; i < self.form.productSpecArr.length; i++) {
if (self.form.productSpecArr[i] == null) {
self.initShowSku();
return;
}
}
// 更新商品规格信息
self.updateSpecProduct();
},
/*更新商品规格信息*/
updateSpecProduct() {
let self = this;
let specSkuId = self.form.productSpecArr.join('_');
// 查找skuItem
let spec_list = self.form.specData.spec_list,
skuItem = spec_list.find((val) => {
return val.spec_sku_id == specSkuId;
});
// 记录product_sku_id
// 更新商品价格、划线价、库存
if (typeof skuItem === 'object') {
self.stock = skuItem.spec_form.stock_num;
if (self.form.show_sku.sum > self.stock) {
self.form.show_sku.sum = self.stock > 0 ? self.stock : 1;
}
self.form.show_sku.product_sku_id = specSkuId;
self.form.show_sku.product_price = skuItem.spec_form.product_price;
self.form.show_sku.line_price = skuItem.spec_form.line_price;
self.form.show_sku.stock_num = skuItem.spec_form.stock_num;
if (skuItem.spec_form.image_id > 0) {
self.form.show_sku.sku_image = skuItem.spec_form.image_path;
} else {
self.form.show_sku.sku_image = self.form.detail.image[0].file_path;
}
}
},
/*关闭弹窗*/
closePopup() {
if (this.form.specData != null) {
for (let i = 0; i < this.form.productSpecArr.length; i++) {
if (this.form.productSpecArr[i] == null) {
uni.showToast({
title: '请选择规格',
icon: 'none',
duration: 2000
});
return;
}
}
}
let product_num = this.form.show_sku.sum;
let params = {
product_id: this.form.detail.product_id,
product_sku_id: this.form.show_sku.product_sku_id
}
this.$emit('close', this.form.specData, params);
},
/*商品增加*/
add() {
if (this.stock <= 0) {
return;
}
if (this.form.show_sku.sum >= this.stock) {
uni.showToast({
title: '数量超过了库存',
icon: 'none',
duration: 2000
});
return false;
}
if (this.form.show_sku.sum >= this.form.detail.limit_num) {
uni.showToast({
title: '数量超过了限购数量',
icon: 'none',
duration: 2000
});
return false;
}
this.form.show_sku.sum++;
},
/*商品减少*/
sub() {
if (this.stock <= 0) {
return;
}
if (this.form.show_sku.sum < 2) {
uni.showToast({
title: '商品数量至少为1',
icon: 'none',
duration: 2000
});
return false;
}
this.form.show_sku.sum--;
}
}
}
</script>
<style lang="scss">
.product-popup {}
.product-popup .popup-bg {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, .6);
z-index: 99;
}
.product-popup .main {
position: fixed;
width: 100%;
min-height: 200rpx;
background-color: #fff;
transform: translate3d(0, 980rpx, 0);
transition: transform .2s cubic-bezier(0, 0, .25, 1);
bottom: env(safe-area-inset-bottom);
}
.product-popup.open .main {
transform: translate3d(0, 0, 0);
z-index: 99;
}
.product-popup.close .popup-bg {
display: none;
}
.product-popup.close .main {
display: none;
z-index: -1;
}
.product-popup .header {
height: 120rpx;
padding: 10rpx 0 10rpx 250rpx;
position: relative;
border-bottom: 1px solid #EEEEEE;
}
.product-popup .header .avt {
position: absolute;
top: -80rpx;
left: 30rpx;
width: 200rpx;
height: 200rpx;
border: 2px solid #FFFFFF;
background: #FFFFFF;
}
.product-popup .header .stock {
font-size: 24rpx;
color: #999999;
}
.product-popup .close-btn {
position: absolute;
width: 40rpx;
height: 40rpx;
top: 10rpx;
right: 10rpx;
}
.product-popup .price {
color: $dominant-color;
font-size: 30rpx;
}
.product-popup .price .num {
padding: 0 4rpx;
font-size: 50rpx;
}
.product-popup .old-price {
margin-left: 10rpx;
font-size: 30rpx;
color: #999999;
text-decoration: line-through;
}
.product-popup .body {
padding: 20rpx 30rpx 100rpx 30rpx;
max-height: 600rpx;
overflow-y: auto;
}
.product-popup .level-box {
display: flex;
justify-content: space-between;
align-items: center;
}
.product-popup .level-box .key {
font-size: 24rpx;
color: #999999;
}
.product-popup .level-box .icon-box {
width: 60rpx;
height: 60rpx;
border: 1px solid #DDDDDD;
background: #f7f7f7;
}
.product-popup .num-wrap .iconfont {
color: #666;
}
.product-popup .num-wrap.no-stock .iconfont {
color: #CCCCCC;
}
.product-popup .level-box .text-wrap {
margin: 0 4rpx;
height: 60rpx;
border: 1px solid #DDDDDD;
background: #f7f7f7;
}
.product-popup .level-box .text-wrap input {
padding: 0 10rpx;
height: 60rpx;
line-height: 60rpx;
width: 80rpx;
text-align: center;
}
.specs .specs-list {
display: flex;
justify-content: flex-start;
align-items: center;
flex-wrap: wrap;
}
.specs .specs-list button {
margin-right: 10rpx;
margin-bottom: 10rpx;
font-size: 24rpx;
}
.specs .specs-list button:after,
.product-popup .btns button,
.product-popup .btns button:after {
height: 88rpx;
line-height: 88rpx;
border: 0;
border-radius: 0;
}
.product-popup .btns .confirm-btn {
margin: 0 auto;
width: 500rpx;
height: 70rpx;
line-height: 70rpx;
border-radius: 35rpx;
background: $dominant-color;
}
</style>

View File

@ -0,0 +1,83 @@
<template>
<div>
<!--地址-->
<template v-if="!extract_store.store_id">
<view class="add-address d-s-c" @click="addAddress()">
<view class="icon-box mr10"><span class="icon iconfont icon-dizhi1"></span></view>
<text>请选择自提点</text>
</view>
</template>
<template v-else>
<view class="address-defalut-wrap">
<view class="info d-s-s">
<text class="state">当前自提点</text>
<view class="province-c-a d-s-s flex-1">
<text>{{ extract_store.region.province }}</text>
<text>{{ extract_store.region.city }}</text>
<text>{{ extract_store.region.region }}</text>
</view>
</view>
<view class="address">
<text class="fb gray3">{{ extract_store.store_name }}</text>
<view class="icon-box" @click="addAddress()"><span class="icon iconfont icon-jiantou"></span></view>
</view>
<view class="user">
<text class="name">{{ extract_store.address }}</text>
<text class="tel">{{ extract_store.phone }}</text>
</view>
</view>
</template>
<view class="addree-bottom">
<view class="stripe" v-for="(item, index) in 10" :key="index">
<text :class="index % 2 == 0 ? 'red' : 'blue'"></text>
<text class="white"></text>
</view>
</view>
<!--自取人的信息-->
<view class="buy-checkout vender">
<view class="group-hd">
<view class="left"><text class="min-name">提货人信息</text></view>
</view>
<view class="item">
<text class="key">联系人</text>
<input type="text" v-model="linkman" class="flex-1 f30" placeholder-class="gray" placeholder="请输入联系人" value="" />
</view>
<view class="item">
<text class="key">联系电话</text>
<input type="text" v-model="phone" class="flex-1 f30" placeholder-class="gray" placeholder="请输入联系电话" value="" />
</view>
</view>
</div>
</template>
<script>
export default {
data() {
return {
linkman: '',
phone: ''
};
},
props: ['extract_store', 'last_extract'],
onLoad() {},
mounted() {
this.linkman = this.last_extract.linkman;
this.phone = this.last_extract.phone;
},
methods: {
/*添加地址*/
addAddress() {
let store_id = -1;
if (this.extract_store.store_id) {
store_id = this.extract_store.store_id;
}
this.gotoPage('/pages/store/address/address?store_id=' + store_id);
}
}
};
</script>
<style scoped>
.buy-checkout.vender .item .key{ width: 200rpx;}
</style>

View File

@ -0,0 +1,538 @@
<template>
<view class="gift-package" v-if="!loadding">
<view class="p20">
<view class="f30 gray6 mb20">配送地址</view>
<view class="o-h" style="border-radius: 20rpx;">
<Myinfo :Address="Address" :existAddress="existAddress"></Myinfo>
</view>
</view>
<view class="p20">
<view class="f30 gray6 mb20">中奖商品</view>
<view class="gift-package-main">
<view class="cuopon-group">
<view class="body">
<view class="item bg-white">
<view class="d-s-c">
<view>
<image class="product_img" :src="detail.image" mode="aspectFill"></image>
</view>
<view class="pro">
<view class="pro_t">{{ detail.record_name }}</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="btns d-e-c">
<button @click="onPay()" class="mr20" v-if="detail.province_id == ''">确认领取</button>
<button class="mr20" v-if="detail.status==1&&detail.delivery_status==10">待发货</button>
</view>
</view>
</template>
<script>
import Myinfo from '@/pages/order/confirm-order/my-info';
import utils from '@/common/utils.js';
export default {
components: {
Myinfo
},
data() {
return {
record_id: 0,
/*是否加载完成*/
loadding: true,
indicatorDots: true,
autoplay: true,
interval: 2000,
duration: 500,
id: 0,
tab_type: 0,
/*详情*/
detail: {},
// 是否存在收货地址
existAddress: false,
/*默认地址*/
Address: null,
};
},
onLoad(e) {
let self = this;
let scene = utils.getSceneData(e);
/*商品id*/
this.record_id = e.record_id;
},
onShow() {
this.getData();
},
methods: {
onPay() {
let self = this;
if (self.Address == null) {
self.showError('请选择收件地址');
return;
}
uni.showLoading({
title: '加载中'
});
let params = {
record_id: self.record_id
};
self._post('plus.lottery.order/buy', params, function(res) {
self.showSuccess('领取成功,请等待工作人员处理', function(res) {
uni.navigateBack();
});
});
},
/*获取数据*/
getData() {
let self = this;
uni.showLoading({
title: '加载中'
});
self.loadding = true;
let params = {
record_id: self.record_id,
};
self._get(
'plus.lottery.order/buy',
params,
function(res) {
self.detail = res.data.data.detail;
self.existAddress = res.data.data.existAddress;
self.Address = res.data.data.address;
uni.hideLoading();
self.loadding = false;
},
function(res) {
uni.navigateBack({
delta: 1
});
}
);
},
hasType(e) {
if (this.deliverySetting.indexOf(e) != -1) {
return true;
} else {
return false;
}
},
/*选择配送方式*/
tabFunc(e) {
this.tab_type = e;
if (e == 0) {
this.delivery = 10;
} else {
this.delivery = 20;
}
this.getData();
},
choosePaytype(payType) {
this.payType = payType;
},
/*关闭弹窗*/
closePopup(e, params) {
this.isPopup = false;
console.log(params);
if (e && e.specAttr) {
this.detail['specName'] = '';
let has = '已选:';
let noone = '';
e.specAttr.forEach(item => {
if (item.specItems) {
let h = '';
for (let i = 0; i < item.specItems.length; i++) {
let child = item.specItems[i];
if (child.checked) {
h = child.specValue + ' / ';
break;
}
}
if (h != '') {
has += h;
} else {
noone += item.groupName;
}
}
});
this.productSkuId = params.productSkuId;
if (noone != '') {
this.detail.specName = noone;
} else {
has = has.replace(/(\s\/\s)$/gi, '');
this.detail.specName = has;
}
console.log(this.detail.specName);
}
},
/* 打开弹窗 */
openPopup(e, spe, detail) {
let obj = {
specData: spe,
detail: detail,
productSpecArr: spe != null ? new Array(spe.specAttr.length) : [],
showSku: {
skuImage: '',
seckillPrice: 0,
productSkuId: 0,
linePrice: 0,
seckillStock: 0,
seckillProductSkuId: 0,
sum: 1
},
type: e
};
this.productModel = obj;
this.isPopup = true;
}
}
};
</script>
<style>
page {
background-color: #f2f2f2;
}
/*top-tab*/
.top-tabbar {
height: 90rpx;
line-height: 86rpx;
display: flex;
justify-content: space-between;
align-items: center;
background: #ffffff;
border-bottom: 1px solid #dddddd;
}
.tab-item {
flex: 1;
height: 90rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 28rpx;
color: #666666;
}
/* */
.gift-package {
position: relative;
min-height: 100vh;
padding-bottom: 100rpx;
}
.gift-package .gift-package-main {
background: #ffffff;
padding: 25rpx 20rpx;
border-radius: 20rpx;
box-sizing: border-box;
}
.order_tit {
padding-left: 30rpx;
font-size: 28rpx;
margin-bottom: 73rpx;
}
.gift-package-main .giftpackagr-info {
margin: 0 auto;
width: 350rpx;
height: 43rpx;
line-height: 43rpx;
border: 1rpx solid #fa212c;
margin-top: 18rpx;
background: rgba(255, 255, 255, 0.8);
border-radius: 30rpx;
text-align: center;
}
.gift-package-main .giftpackagr-info .detatime {
/* padding:10px 30px; */
font-size: 18rpx;
color: #fa1f29;
font-weight: 800;
}
.cuopon-group {
color: #ffffff;
text-align: center;
font-size: 30rpx;
background-color: #ffffff30;
border-radius: 15rpx;
}
.cuopon-title {
color: #919191;
font-size: 35rpx;
margin-bottom: 20rpx;
}
.cuopon-group .title {
font-size: 24rpx;
color: #cacaca;
text-align: left;
}
.cuopon-group .body {}
.cuopon_item {
position: relative;
}
.item_cuopon {
z-index: 50;
}
.cuopon-group .body .item {
display: flex;
flex-direction: column;
border-radius: 20rpx;
position: relative;
}
.cuopon_img {
width: 493rpx;
height: 123rpx;
position: absolute;
top: 0;
left: 0;
}
.cuopon-group .body .item .price {
z-index: 50;
font-size: 18rpx;
margin-left: 26rpx;
}
.cuopon-group .body .item .des {
z-index: 50;
padding: 26rpx 0;
font-size: 24rpx;
text-align: left;
margin-left: 50rpx;
}
.item .des .des_t {
font-size: 26rpx;
color: #000000;
margin-bottom: 12rpx;
}
.item .des .des_c {
font-size: 18rpx;
color: #6b6b6b;
margin-bottom: 8rpx;
}
.item .des .des_b {
font-size: 18rpx;
color: #6b6b6b;
}
.t-c {
text-align: center;
}
.gift-package-main .integral {
background-color: #ffffff66;
padding-bottom: 60rpx;
border-radius: 15rpx;
}
.gift-package-main .integral .title {
font-size: 24rpx;
color: #cacaca;
text-align: left;
}
.gift-package-main .integral_btom {
border: 1rpx solid #cacaca;
height: 193rpx;
background-color: #ffffff;
margin-top: 20rpx;
border-radius: 15rpx;
}
.gift-package-main .integral .info {
margin-left: 30rpx;
width: 300rpx;
color: #f0510e;
}
.gift-package-main .integral image {
width: 135rpx;
height: 135rpx;
margin-left: 40rpx;
}
.gift-package-main .integral .num {
font-size: 50rpx;
}
.btns {
width: 100%;
height: 100rpx;
display: flex;
justify-content: flex-end;
align-items: center;
position: fixed;
bottom: 0;
background-color: #ffffff;
border-top: 1rpx solid #eeeeee;
z-index: 99;
}
.order_price {
text-align: right;
color: #fd0000;
font-size: 30rpx;
margin-left: 30rpx;
}
.btns button {
width: 266rpx;
height: 70rpx;
background-color: #ee1413;
color: #ffffff;
text-align: center;
line-height: 70rpx;
border-radius: 35rpx;
}
.rule {
overflow: hidden;
position: absolute;
right: 0;
top: 480rpx;
z-index: 100;
}
.rule_btn {
margin-top: 27rpx;
width: 183rpx;
height: 62rpx;
line-height: 62rpx;
text-align: center;
background-color: #e83514;
border: 1rpx solid #ffffff;
border-top-left-radius: 32rpx;
border-bottom-left-radius: 32rpx;
color: #ffffff;
font-size: 26rpx;
}
.add {
font-size: 73rpx;
font-weight: 900;
text-align: center;
color: #ffffff;
}
.cuopon_num {
display: inline-block;
width: 40rpx;
height: 40rpx;
border: 1rpx solid #939393;
margin-left: 150rpx;
text-align: center;
line-height: 40rpx;
font-size: 18rpx;
border-radius: 10rpx;
position: absolute;
top: 40px;
right: 15px;
color: #000000;
}
.product_img {
width: 146rpx;
height: 146rpx;
}
.pro {
margin-left: 12rpx;
text-align: left;
flex: 1;
height: 146rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
}
.pro_t {
font-size: 26rpx;
color: #333;
margin-bottom: 15rpx;
}
.pro_c {
font-size: 20rpx;
color: #686868;
}
.pro_b {
font-size: 28rpx;
color: #fd0000;
}
.f18 {
font-size: 18rpx;
}
.pro_choose {
width: 33rpx;
height: 33rpx;
position: absolute;
right: 10rpx;
top: 6rpx;
}
.borbox {
border: 1rpx solid #cacaca;
}
.type_activ {
width: 40rpx;
height: 40rpx;
background-color: #04be01;
border-radius: 50%;
overflow: hidden;
text-align: center;
line-height: 1;
}
.icon-tijiaochenggong {
color: #ffffff;
font-size: 22rpx;
}
.speci {
font-size: 24rpx;
width: 100rpx;
height: 44rpx;
color: #ffffff;
text-align: center;
border-radius: 22rpx;
background-color: #fd0000;
line-height: 44rpx;
}
.pro_not {
width: 33rpx;
height: 33rpx;
position: absolute;
right: 10rpx;
top: 6rpx;
border: 1rpx solid #cacaca;
border-radius: 50%;
}
</style>