增加新功能

This commit is contained in:
hejiangming
2025-03-23 20:36:06 +08:00
parent 2ae62b59ed
commit 78270eeda0
184 changed files with 2690 additions and 1496 deletions
+43 -29
View File
@@ -29,7 +29,7 @@
</template>
</up-swiper>
</view>
<!-- 分类 -->
<!-- banner图 -->
<view class="home_sort_warp">
<view class="sort_warp">
<view v-for="item in sortList" :key="item.id" class="sort_item">
@@ -55,16 +55,17 @@
</view>
</view>
<view class="product_content">
<up-loading-icon :show="productLoading"></up-loading-icon>
<view class="product_item" v-for="item in yxProduct" :key="item.id">
<up-image :src="item.url" width="100%" height="100" bgColor="#f1f6ff00" shape="square" radius='16'></up-image>
<view class="product_f_item">
<view class="product_f_item_name">{{item.name}}</view>
<view class="product_f_item_price product_f_item_price_yx">优选价 99元</view>
<view class="product_f_item_name">{{item.title}}</view>
<view class="product_f_item_price product_f_item_price_yx">优选价 {{item.price}}元</view>
</view>
</view>
</view>
</view>
<!-- 哈希优品 福利价-->
<!-- 爆款专区-->
<view class="product_comm hx_warp">
<view class="product_title">
<view class="product_title_left">
@@ -77,17 +78,18 @@
</view>
</view>
<view class="product_content">
<view class="product_item" v-for="item in yxProduct" :key="item.id">
<up-loading-icon :show="productLoading"></up-loading-icon>
<view class="product_item" v-for="item in faddishProduct" :key="item.id">
<up-image :src="item.url" width="100%" height="100" bgColor="#f1f6ff00" shape="square" radius='16'></up-image>
<view class="product_f_item">
<view class="product_f_item_name">{{item.name}}</view>
<view class="product_f_item_price product_f_item_price_hx">优选价 99元</view>
<view class="product_f_item_name">{{item.title}}</view>
<view class="product_f_item_price product_f_item_price_hx">优选价 {{item.price}}元</view>
</view>
</view>
</view>
</view>
<!-- 热门榜 -->
<view class="hot_warp">
<!-- <view class="hot_warp">
<view class="hot_title_warp">
<view class="title_warp">
<text class="title_">热门榜</text>
@@ -113,7 +115,7 @@
</view>
</view>
</view>
</view>
</view> -->
<!-- 哈希商学院 -->
<view class="business_school_warp">
<view>
@@ -134,6 +136,8 @@
<script>
import choiceness from '@/components/choiceness/choiceness.vue';
import { searchList } from '@/api/product.js';
import { SEARCH_TYPE } from '@/utils/enumUtils.js'
export default {
components:{choiceness},
@@ -198,24 +202,8 @@
},
],
currentLanguage:{},
yxProduct:[
{
id:1,
name:"中文中文中文中文中文",
url:"/static/common/product_def.png",
price:99,
},{
id:2,
name:"中文中文中文中文",
url:"/static/common/product_def.png",
price:99,
},{
id:3,
name:"中文中文中文中文中文",
url:"/static/common/product_def.png",
price:99,
},
],
yxProduct:[],// 好物优选列表
faddishProduct:[],// 爆款专区
hotList:[
{
id:1,
@@ -238,9 +226,14 @@
url:"/static/common/product_def.png",
price:99,
},
]
],// 热门
productLoading:false,
}
},
mounted() {
this.querySearchList(SEARCH_TYPE.SOMETHING);// 好物专区
this.querySearchList(SEARCH_TYPE.EXPLOSIVE);// 爆单专区
},
methods: {
jumpTurntable(){
uni.navigateTo({
@@ -262,6 +255,26 @@
url:'/pages/search/search',
})
},
/**
* 查询商品列表
*/
async querySearchList(type){
this.productLoading = true;
const params = {
type,
page:1,
pageSize:3,
}
const resp = await searchList(params);
if(resp && resp.bizcode === 100){
if(type === SEARCH_TYPE.SOMETHING){// 好物优选
this.yxProduct = resp.data;
}else if(type === SEARCH_TYPE.EXPLOSIVE){// 爆单专区
this.faddishProduct = resp.data;
}
}
this.productLoading = false;
}
}
}
</script>
@@ -378,12 +391,13 @@
padding: 20rpx;
border-radius: 24rpx;
display: flex;
justify-content: space-between;
// justify-content: space-between;
align-items: center;
.product_item{
width: 32%;
border-radius: 16rpx;
position: relative;
margin-right: 20rpx;
}
.product_f_item{
position: absolute;
+17 -5
View File
@@ -55,7 +55,8 @@
</view>
<view class="login_comm_but login_comm_but_yes" @click="loginFun">
登录
<up-loading-icon color="#FFFFFF" :show="butLoading"></up-loading-icon>
<text style="margin-left: 10rpx;">登录</text>
</view>
<view class="cut_way_warp">
<view v-if="loginWay === 'password'" @click="loginWay = 'code'">验证码登录</view>
@@ -90,7 +91,7 @@
import InputCodeComm from '@/components/code-comm/code-comm.vue';
import { SMS_TYPE } from '@/utils/enumUtils.js';
import { getUserList } from '@/api/common.js';
import { loginbysms } from '@/api/login.js';
import { loginbysms,loginbypw } from '@/api/auth.js';
import { setStorageFun,TOKEN_NAME,USER_KEY,USER_DATA,USER_LOGIN_TIME } from '@/utils/auth.js';
export default {
@@ -115,6 +116,7 @@
isShow:false,// 是否显示
isPolicy:false,// 是否同意
countdown:false,// 清空倒计时
butLoading:false,
}
},
methods: {
@@ -142,9 +144,12 @@
});
return;
}
this.butLoading=true;
let response={};
if(this.loginWay === 'password'){
params.mobile = form.name;
params.password = form.password;
response = await loginbypw(params);
}else{
params.mobile = form.name;
params.smsCode = form.code;
@@ -158,24 +163,28 @@
avatar:data.avatarUrl,
name: data.name,
userId: data.userId,
grade:data.grade,
inviteCode:data.inviteCode,
};
setStorageFun(USER_DATA,userInfo);
// 当前登录得时间戳
let currentTimeStamp = new Date().getTime();
setStorageFun(USER_LOGIN_TIME,currentTimeStamp);
this.butLoading=false;
this.$refs.uToastRef.show({
type: 'success',
message: response.msg,
});
setTimeout(()=>{
then.jumpHome();
},2000);
},
checkNameParam(val){
console.log("val",val);
// console.log("val",val);
},
checkParam(val){
console.log("val",val);
// console.log("val",val);
},
/**
* 获取手机验证码
@@ -196,6 +205,7 @@
type:SMS_TYPE.LOGIN,
}
const response = await getUserList(params);
console.log("responseresponseresponse",response);
if(response && response.bizcode === 100){
this.$refs.uToastRef.show({
type: 'success',
@@ -243,6 +253,8 @@
font-size: 32rpx;
color: #999999;
padding: 28rpx 0;
display: flex;
justify-content: center;
}
.login_comm_but_yes{
background: $app-bt-bj;
+4 -6
View File
@@ -9,8 +9,8 @@
<up-image src="/static/mine/lv01.png" width="10" height="18" bgColor="#f1f6ff00"></up-image>
</view>
<view class="mine_info_id">
<text style="margin-right: 20rpx;">ID:{{userData.userId}} </text>
<up-image src="/static/common/copy.png" width="14" height="14" bgColor="#f1f6ff00" @click="copyData(userData.userId)"></up-image>
<text style="margin-right: 20rpx;">ID:{{userData.inviteCode}} </text>
<up-image src="/static/common/copy.png" width="14" height="14" bgColor="#f1f6ff00" @click="copyData(userData.inviteCode)"></up-image>
</view>
</view>
</view>
@@ -114,8 +114,8 @@
url:'/static/mine/order_notReceive.png',
path:"/pages/mine_order/mine_order"
},{
id:ORDER_TYPE.AFTER_SALE,
title:"退款售后",
id:ORDER_TYPE.SUCCEED,
title:"待评价",
url:'/static/mine/order_afterSale.png',
path:"/pages/mine_order/mine_order"
},
@@ -214,8 +214,6 @@
let path = '/pages/mine_order/mine_order'
if(item && Object.keys(item).length!==0){
path = '/pages/mine_order/mine_order?type='+item.id
}else{
path = '/pages/mine_order/mine_order?type=0';
}
uni.navigateTo({
url:path,
+1 -1
View File
@@ -28,7 +28,7 @@
</view>
<view v-else class="not_order_warp">
<view class="not_order_warp_img"><up-image src="/static/common/not_search.png" width="100" height="100" bgColor="#f1f6ff00"></up-image></view>
<view class="not_order_msg_warp">暂时地址,快去添加吧~</view>
<view class="not_order_msg_warp">暂无地址,快去添加吧~</view>
</view>
<view class="add_but" @click="jumpAddAddress">
新增地址
+40 -28
View File
@@ -6,7 +6,7 @@
</view>
<view class="order_type_title">
<view
:class="type === item.id ? 'order_type_title_item order_type_title_item_sel':'order_type_title_item'"
:class="form.type === item.id ? 'order_type_title_item order_type_title_item_sel':'order_type_title_item'"
v-for="item in orderTypeList"
@click="checkType(item)"
:key="item.id"
@@ -20,12 +20,12 @@
<!-- 头部 -->
<view class="order_item_header">
<view class="order_item_header_left">
<up-image :src="item.url" width="22" height="22" bgColor="#f1f6ff00"></up-image>
<view class="order_product_title">{{item.name}}</view>
<up-image :src="item.shopLogo" width="22" height="22" bgColor="#f1f6ff00"></up-image>
<view class="order_product_title">{{item.shopName}}</view>
</view>
<!-- 除开待付款 -->
<view
v-if="item.status !== 1"
v-if="item.status !== ORDER_TYPE.UNPAID"
class="order_item_header_right"
:style="{'color': ORDER_STATUS_CSS[item.status]}">
{{getValue(ORDER_STATUS,item.status)}}
@@ -33,41 +33,41 @@
<!-- 待付款 -->
<view v-else class="order_item_header_right order_right_due">
<view class="order_right_due_msg">等待付款</view>
<view class="order_right_due_time">{{item.paymentTime}}分钟</view>
<view class="order_right_due_time">{{item.expireTime}}分钟</view>
</view>
</view>
<!-- 产品详情 -->
<view class="order_item_content">
<view v-for="pItem in item.product" :key="pItem.id" class="content_item">
<up-image :src="pItem.url" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view v-for="pItem in item.items" :key="pItem.id" class="content_item">
<up-image :src="pItem.mainGraph" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="content_info">
<view class="content_info_title">{{pItem.title}}</view>
<view class="content_info_tag">{{pItem.tag.join(" ")}}</view>
<view>
<view class="content_info_tag">{{pItem.goodsSpece}}</view>
<!-- <view>
<text class="content_info_description" v-for="dItem in pItem.description">
{{dItem}}
</text>
</view>
</view> -->
</view>
<view class="content_right">
<view class="content_right_total">¥{{pItem.total}}</view>
<view class="content_right_quantity">x{{pItem.quantity}}</view>
<view class="content_right_total">¥{{pItem.goodsAmount}}</view>
<view class="content_right_quantity">x{{pItem.buyNum}}</view>
</view>
</view>
</view>
<!-- 汇总 -->
<view class="order_item_collect">
<view class="collect_msg">共1件,合计¥3599</view>
<view class="collect_msg">共{{item.buyNum}}件,合计¥{{item.sumAmount}}</view>
<view class="collect_operate">
<view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.UNSHIPPED" @click="checkCancel(true)">取消订单</view>
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.UNPAID" @click="jumpOrderInfo">去付款</view>
<view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.COMPLETED">申请退款</view>
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.COMPLETED">申请退款</view> -->
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.NOT_RECEIVE">确认收货</view>
<view class="operate_comm operate_but_3" v-if="item.status === ORDER_TYPE.UNSHIPPED">提醒发货</view>
<view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.COMPLETED">申请售后</view>
<view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.AFTER_SALE">查看售后</view>
<view class="operate_comm operate_but_1" v-if="[ORDER_TYPE.COMPLETED].includes(item.status)">删除记录</view>
<view class="operate_comm operate_but_3" v-if="[ORDER_TYPE.COMPLETED,ORDER_TYPE.CANCELED].includes(item.status)">再次购买</view>
<!-- <view class="operate_comm operate_but_3" v-if="item.status === ORDER_TYPE.UNSHIPPED">提醒发货</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.COMPLETED">申请售后</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.AFTER_SALE">查看售后</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="[ORDER_TYPE.COMPLETED].includes(item.status)">删除记录</view> -->
<!-- <view class="operate_comm operate_but_3" v-if="[ORDER_TYPE.COMPLETED,ORDER_TYPE.CANCELED].includes(item.status)">再次购买</view> -->
</view>
</view>
</view>
@@ -118,6 +118,7 @@
<script>
import { ORDER_TYPE,ORDER_STATUS,getValue } from '@/utils/enumUtils.js';
import { ORDER_STATUS_CSS } from '@/utils/enumCssUtils.js';
import { getOrderList } from '@/api/order.js';
export default {
computed: {
@@ -133,12 +134,7 @@
},
data() {
return {
type:0,// 选中的类型
orderTypeList:[
{
id:0,
title:"全部",
},
{
id:ORDER_TYPE.UNPAID,
title:"待支付",
@@ -149,12 +145,15 @@
id:ORDER_TYPE.NOT_RECEIVE,
title:"待收货",
},{
id:ORDER_TYPE.AFTER_SALE,
title:"退款售后",
id:ORDER_TYPE.SUCCEED,
title:"待评价",
},
],
form:{
search:null,//搜索
page:1,
pageSize:15,
type:0,// 选中的类型
},
orderList:[
{
@@ -284,7 +283,8 @@
},
onLoad(options) {
const type = options.type;
this.type = type ? parseInt(type,10) : 0;
this.form.type = type ? parseInt(type,10) : ORDER_TYPE.UNPAID;
this.getOrderList();
},
methods: {
getValue,
@@ -297,13 +297,24 @@
console.log("searchFun",val);
},
checkType(item){
this.type = item.id;
this.form.type = item.id;
this.getOrderList();
},
jumpOrderInfo(){
uni.navigateTo({
url:"/pages/mine_order_info/mine_order_info?type="+this.type,
})
},
async getOrderList(){
const params = {
...this.form,
}
const resp = await getOrderList(params);
console.log("resp",resp);
if(resp && resp.bizcode === 100){
this.orderList = resp.data;
}
},
checkCancel(status){
this.cancelShow = status;
if(!status){
@@ -313,6 +324,7 @@
}
}
},
/**
* 确认取消
*/
+80 -3
View File
@@ -41,7 +41,22 @@
<view class="info_title_item_sel_but_warp" v-if="selInfo === item.id"></view>
</view>
</view>
<view class="info_list_warp">
<!-- 抽奖 -->
<view class="prize_draw_warp" v-if="selInfo === 6">
<view class="prize_draw_item" v-for="item in prizeDrawList" :key="item.id">
<view class="prize_draw_left_warp">
<up-image src="/static/mine/purse_sf.png" width="40" height="40" bgColor="#f1f6ff00"></up-image>
<view style="margin-left: 20rpx;">
<view class="title_">{{item.name}}</view>
<view class="time_">{{item.time}}</view>
</view>
</view>
<view class="prize_draw_right_warp" v-if="item.isShowGet" v-show="item.isGet">去领取</view>
<view class="prize_draw_right_warp yes_" v-if="item.isShowGet" v-show="!item.isGet">已领取</view>
</view>
</view>
<view class="info_list_warp" v-else>
<view v-for="item in orderList" :key="item.id" class="purse_info_item">
<view class="purse_info_left">
<up-image :src="item.type === 1? '/static/mine/purse_sf.png' : '/static/mine/purse_xf.png'" width="40" height="40" bgColor="#f1f6ff00"></up-image>
@@ -81,8 +96,12 @@
id:5,
name:"HMC"
},
{
id:6,
name:"抽奖"
},
],
selInfo:1,
selInfo:6,
orderList:[
{
id:1,
@@ -120,7 +139,30 @@
amount:1000,
typeName:"收入到账",
},
]
],// 其他列表
prizeDrawList:[
{
id:1,
name:'20元优惠券',
time:'01-01 14:10:10',
isGet:false,// 未领取
isShowGet:true,
},
{
id:2,
name:'20元优惠券',
time:'01-01 14:10:10',
isGet:true,// 已领取
isShowGet:true,
},
{
id:3,
name:'20元优惠券',
time:'01-01 14:10:10',
isGet:false,// 已领取
isShowGet:false,
},
],// 抽奖列表
}
},
methods: {
@@ -177,6 +219,41 @@
.info_warp{
margin-top: 30rpx;
.prize_draw_warp{
.prize_draw_item{
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 0;
border-bottom: 1rpx solid #EEEEEE;
}
.prize_draw_left_warp{
display: flex;
align-items: center;
}
.title_{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.time_{
font-size: 24rpx;
color: #666666;
margin-top: 10rpx;
}
.prize_draw_right_warp{
background: $app-bt-bj;
border-radius: 10rpx;
text-align: center;
color: #FFFFFF;
padding: 10rpx 28rpx;
height: 48rpx;
}
.yes_{
background: #F5F5F5;
color: #666666;
}
}
.info_title_warp{
display: flex;
padding-left: 10rpx;
+123 -13
View File
@@ -155,7 +155,8 @@
<script>
import Address from '@/components/address.vue';
import { PAYMENT_WAY,PAYMENT_WAY_,PRODUCT_DELIVERY_TIME,getValue } from '@/utils/enumUtils.js';
import { getSettleList } from '@/api/cart.js'
import { getSettleList,settle } from '@/api/cart.js'
import { feedback } from '@/api/payment.js';
import { assembleAddress } from '@/utils/index.js'
export default {
@@ -242,7 +243,6 @@
}
data.shops = shops;
data.paymentMethod = null;// 支付方式
console.log("data",data);
this.orderInfo = data;
}
},
@@ -274,29 +274,138 @@
// 获取备注
getRemark(){
const orderInfo = this.orderInfo;
console.log("orderInfo",orderInfo);
const remarkArr = [];
if(orderInfo && Object.keys(orderInfo).length!==0){
const remarObj={};
if(orderInfo.shops && orderInfo.shops.length!==0){
orderInfo.shops.map(sItem=>{
if(sItem.addrTimes && sItem.addrTimes.length !==0){
sItem.addrTimes.map(addItem=>{
if(addItem.remark){
remarObj.gkey = addItem.groupKey;
remarObj.rmk = addItem.remark;
}
})
}
})
}
remarkArr.push(remarObj);
}
console.log("remarkArr",remarkArr);
return remarkArr;
},
/**
* 去支付
*/
goPay(){
async goPay(){
const orderInfo = this.orderInfo;
const way = orderInfo.paymentMethod;
if(!way || way === 0){
this.$refs.uToastRef.show({
type: 'error',
message: "请先选择支付方式",
});
return;
}
const params={
addrId:this.orderInfo.address.id,// 收货地址ID
addrId:orderInfo.address.id,// 收货地址ID
cartIds:this.ids,//结算的购物车ID,多个以逗号分割,ALL表示全选
payway:0,// 支付方式:1-微信,2-支付宝
remark:null,//备注信息'[{"sid":"店铺ID","rmk":"备注内容"},{"sid":"店铺ID","rmk":"备注内容"}]'
payway:way,// 支付方式:1-微信,2-支付宝
remark:JSON.stringify(this.getRemark()),//备注信息'[{"sid":"店铺ID","rmk":"备注内容"},{"sid":"店铺ID","rmk":"备注内容"}]'
}
console.log("params",params);
// 支付成功的页面
// uni.navigateTo({
// url:"/pages/order_submit_ok/order_submit_ok",
// })
const resp = await settle(params);
// 提交订单成功,就唤起支付
if(resp && resp.bizcode === 100){
const item = resp.data;
if(params.payway === PAYMENT_WAY.WECHAT){// APP微信支付
if(item.wechat && Object.keys(item.wechat).length !==0){
this.appWxpay(item.wechat);
}else{
this.$refs.uToastRef.show({
type: 'error',
message: "订单支付失败",
});
}
}else if(params.payway === PAYMENT_WAY.ALIPAY){// 支付宝支付
if(item.alipay && Object.keys(item.alipay).length !==0){
this.zfbPay(item.alipay);
}else{
this.$refs.uToastRef.show({
type: 'error',
message: "订单支付失败",
});
}
}
}
},
// app 微信支付
appWxpay(item){
const newThis = this;
const orderInfo = {
"appid": item.appId, // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
"noncestr": item.nonceStr, // 随机字符串
"package": "Sign=WXPay", // 固定值
"partnerid": item.partnerId, // 微信支付商户号
"prepayid": item.prepayId, // 统一下单订单号
"timestamp": item.timeStamp, // 时间戳(单位:秒)
"sign": item.sign // 签名,这里用的 MD5/RSA 签名
};
uni.requestPayment({
provider:"wxpay",
orderInfo: orderInfo,
success: function(res) {
console.log('success:' + res);
newThis.payFeedbackFun(item.orderId,res.orderNum,1);
newThis.jumpWayOk();
},
fail: function(err) {
console.log('fail:',err);
this.$refs.uToastRef.show({
type: 'error',
message: "支付失败",
});
}
});
},
// 支付宝支付
zfbPay(item){
const that = this;
uni.requestPayment({
provider: 'alipay',
orderInfo: item.orderStr,
success(res) {
console.log("res",res);
that.payFeedbackFun(item.orderId,item.orderNum,1);
that.jumpWayOk();
},
//调用失败的回调
fail(err) {
console.log('fail:',err);
this.$refs.uToastRef.show({
type: 'error',
message: "支付失败",
});
}
})
},
// 跳转到支付成功页面
jumpWayOk(){
uni.navigateTo({
url:"/pages/order_submit_ok/order_submit_ok",
})
},
// 支付结果回调
async payFeedbackFun(orderId,orderNum,status){
const params = {
orderId,
orderNum,
status,
}
console.log("params",params);
const response = await feedback(params);
console.log("反馈结果",response);
},
// 地址选中
getAddressValueFunc(item){
@@ -304,6 +413,7 @@
addressObj.addressStr = assembleAddress(addressObj).names;
this.selectAddress = addressObj;
},
// 地址选中OK
addressOk(){
const type = this.addressType;
const addressIndex = this.addressIndex;
+36 -64
View File
@@ -16,25 +16,26 @@
<view class="msg">好物优选</view>
</view>
<view class="preference_product">
<view class="product_item" v-for="item in productList">
<up-loading-page :loading="productListLoading"></up-loading-page>
<view class="product_item" v-for="(item,index) in productList" :key="index" @click="jumpInfo(item)">
<view class="product_item_left">
<up-image :src="item.url" width="100" height="100" bgColor="#f1f6ff00"></up-image>
<view class="product_item_left_bz product_item_left_bz_img" v-if="item.type === 1">
<view class="product_item_left_bz product_item_left_bz_img">
<view>爆款专区</view>
</view>
</view>
<view class="product_item_right">
<view class="title_warp">{{item.name}}</view>
<view class="title_warp">{{item.title}}</view>
<view class="price_warp">
<view class="price_o_warp">
<view class="price_o_title_warp">原价</view>
<view class="price_o_value_warp">
<text>¥</text>
<text>{{item.oPrice}}</text>
<text>{{item.adPrice}}</text>
</view>
</view>
<view class="price_zq_warp">
<view class="price_lj_warp">专区立省{{item.zqPrice}}元</view>
<view class="price_lj_warp">专区立省{{item.adPrice - item.price}}元</view>
<view class="price_ds_warp">到手¥<text style="font-size: 31rpx;">{{item.price}}</text></view>
</view>
</view>
@@ -46,73 +47,22 @@
</template>
<script>
import { searchList } from '@/api/product.js';
import { SEARCH_TYPE } from '@/utils/enumUtils.js';
export default {
data() {
return {
swiperList:[
'/static/home/banner03.png',
],
productList:[
{
id:1,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:1,// 1:爆款区的 0:普通区
},{
id:2,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:0,
},{
id:3,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:0,
},{
id:4,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:1,
},{
id:5,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:0,
},{
id:6,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:0,
},{
id:7,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:0,
},
]
productList:[],
productListLoading:false,
}
},
onLoad() {
this.getSearchList();
},
methods: {
jumpHome(){
uni.switchTab({
@@ -125,6 +75,28 @@
url: '/pages/invite_friends/invite_friends',
})
},
async getSearchList(){
this.productListLoading = true;
const params = {
type:SEARCH_TYPE.SOMETHING,
page:1,
pageSize:99,
}
const resp = await searchList(params);
if(resp && resp.bizcode === 100){
this.productList = resp.data;
}
this.productListLoading = false;
},
/**
* 跳转到商品详情
* @param {Object} item
*/
jumpInfo(item){
uni.navigateTo({
url: '/pages/productInfo/productInfo?id='+item.id,
})
}
}
}
</script>
+30 -38
View File
@@ -96,13 +96,17 @@
<view class="product_but_warp">
<view class="product_but_left">
<view class="left_item">
<up-image src="/static/product/home.png" width="20" height="20" bgColor="#f1f6ff00" @click="jumpHome"></up-image>
<up-image src="/static/product/home.png" width="20" height="20" bgColor="#f1f6ff00" @click="jumpOther('home')"></up-image>
<view>首页</view>
</view>
<view class="left_item">
<up-image src="/static/product/kefu.png" width="20" height="20" bgColor="#f1f6ff00" @click="jumpShare"></up-image>
<up-image src="/static/product/kefu.png" width="20" height="20" bgColor="#f1f6ff00" @click="jumpOther('share')"></up-image>
<view>咨询</view>
</view>
<view class="left_item">
<up-image src="/static/product/cart.png" width="24" height="20" bgColor="#f1f6ff00" @click="jumpOther('cart')"></up-image>
<view>购物车</view>
</view>
</view>
<view class="product_but_right">
<view class="but_comm join_warp" @click="checkSpecification(true,'addCart')">加入购物车</view>
@@ -111,7 +115,7 @@
</view>
<!-- 选择规格的弹框 -->
<up-popup
v-model:show="specificationShow"
:show="specificationShow"
:round="10"
:closeOnClickOverlay="false"
:closeable="true"
@@ -212,19 +216,7 @@
currentNum:1,
specificationShow:false,
specificationShowType:'',// 弹框类型
orderInfo:{
id:1,
url:"/static/common/product_def.png",
price:87.00,
oPrice:199.00,
couponPrice:50,
inventory:100,// 库存
quantity:1,
addressObj:{
name:'李个',
address:'郑州市金水区东风路街道白庙小区五号楼'
},
},
orderInfo:{},
specificationList:[],//规格
selectSpecification:[],// 选择的规格
specificationTempl:[],// 规格模版数据
@@ -246,16 +238,20 @@
delta: 1 // 返回的页面数,默认为1,返回到上一级
});
},
jumpHome(){
uni.switchTab({
url: '/pages/home/home',
})
},
// 分享
jumpShare(){
uni.navigateTo({
url: '/pages/invite_friends/invite_friends',
})
jumpOther(type){
if(type === 'home'){
uni.switchTab({// 首页
url: '/pages/home/home',
})
}else if(type === "share"){// 分享
uni.navigateTo({
url: '/pages/invite_friends/invite_friends',
})
}else if(type === "cart"){// 购物车
uni.switchTab({
url: '/pages/shopping_cart/shopping_cart',
})
}
},
/**
* 查询详细内容
@@ -275,14 +271,16 @@
data.quantity=1// 数量
data.inventory=0// 库存
this.orderInfo = data;
this.getSpecification(data.specs);
}
},
checkSpecification(val,type){
async checkSpecification(val,type){
// 需要查询一下最新的规格
if(val){
this.querySpecification()
await this.querySpecification()
const data = this.orderInfo;
this.getSpecification(data.specs);
}else{
this.specificationList=[];//规格
this.selectSpecification=[];// 选择的规格
@@ -293,12 +291,10 @@
},
// 拆解规格
getSpecification(specs){
console.log("specs",specs);
const optionArr=[];
if(specs){
const arr = JSON.parse(specs);
arr.map(item=>{
console.log("item",item);
optionArr.push({
type:item.type,
items:item.items,
@@ -373,9 +369,7 @@
}
this.orderInfo.quantity = currentQuantity;
},
/**
* 立即购买,确定订单页面
*/
// 立即购买,确定订单页面
byFun(){
// 先加入购物车,再去购买
this.addCart();
@@ -383,9 +377,7 @@
url: '/pages/order_submit/order_submit',
})
},
/**
* 加入购入车
*/
// 加入购入车
async addCart(){
const selectTempl = this.selectSpecificationTempl;
if(!selectTempl || Object.keys(selectTempl).length ===0){
@@ -546,7 +538,7 @@
.product_but_left{
display: flex;
justify-content: space-between;
width: 30%;
width: 36%;
.left_item{
width: 50%;
text-align: center;
+79 -59
View File
@@ -14,12 +14,12 @@
<up-input
placeholder="请输入验证码"
border="surround"
v-model="form.code"
v-model="form.smsCode"
:customStyle="inputCss"
>
<template #suffix style="margin-right: 10rpx;">
<view v-if="countdown" class="code-warp">
<up-count-down :time="60 * 1000" format="ss" @finish="getCode(false)"></up-count-down>
<up-count-down :time="60 * 1000" format="ss" @finish="countdown = false"></up-count-down>
<text style="margin-left: 10rpx;">s</text>
</view>
<view v-else @click="getMobileCode" class="code_msg">
@@ -56,7 +56,7 @@
</template>
</up-input>
</view>
<view class="register_info_item">
<!-- <view class="register_info_item">
<up-input
placeholder="请输入交易密码"
border="surround"
@@ -69,7 +69,7 @@
<up-image v-else src="/static/login/hidden.png" width="20" height="20" bgColor="#f1f6ff00" @click="transactionCodeIsShow=true;"></up-image>
</template>
</up-input>
</view>
</view> -->
<view class="register_info_item">
<up-input
placeholder="推荐码"
@@ -80,7 +80,7 @@
</view>
</view>
<view class="login_comm_but login_comm_but_yes" @click="registerFun">
<view class="login_comm_but login_comm_but_yes" @click="registerFun" :loading="butLoading">
注册
</view>
<view class="policy_warp">
@@ -106,12 +106,17 @@
</template>
<script>
import { SMS_TYPE } from '@/utils/enumUtils.js';
import { getUserList } from '@/api/common.js';
import { register } from '@/api/auth.js';
import { setStorageFun,TOKEN_NAME,USER_KEY,USER_DATA,USER_LOGIN_TIME } from '@/utils/auth.js';
export default {
data() {
return {
form:{
mobile:null,
code:null,// 验证码
smsCode:null,// 验证码
loginPassword:null,
loginPassword2:null,
transactionCode:null,// 交易密码
@@ -129,50 +134,48 @@
loginPassword2IsShow:false,
transactionCodeIsShow:false,// 交易密码
isPolicy:false,
butLoading:false,
}
},
methods: {
registerFun(){
const params = {
...this.form,
}
console.log("params",params);
if(!params.mobile){
async registerFun(){
const form = this.form;
if(!form.mobile){
this.$refs.uToastRef.show({
type: 'error',
message: "请输入手机号",
});
return;
}
if(!params.code){
if(!form.smsCode){
this.$refs.uToastRef.show({
type: 'error',
message: "请输入验证码",
});
return;
}
if(!params.loginPassword){
if(!form.loginPassword){
this.$refs.uToastRef.show({
type: 'error',
message: "请输入登录密码",
});
return;
}
if(!params.loginPassword2){
if(!form.loginPassword2){
this.$refs.uToastRef.show({
type: 'error',
message: "请输入二次确认密码",
});
return;
}
if(params.loginPassword !== params.loginPassword2){
if(form.loginPassword !== form.loginPassword2){
this.$refs.uToastRef.show({
type: 'error',
message: "两次输入的登录密码不一致",
});
return;
}
if(!params.referralCode){
if(!form.referralCode){
this.$refs.uToastRef.show({
type: 'error',
message: "请输入推荐码",
@@ -186,54 +189,71 @@
});
return;
}
console.log("params",params);
uni.switchTab({
url: '/pages/home/home',
})
this.butLoading = true;
const params = {
mobile:form.mobile,
smsCode:form.smsCode,
password:form.loginPassword,
inviteCode:form.referralCode,
}
const resp = await register(params);
if(resp && resp.bizcode === 100){
const data = resp.data;
setStorageFun(TOKEN_NAME,data.token);
// 用于无感登录
setStorageFun(USER_KEY,'');
const userInfo = {
avatar:data.avatarUrl,
name: data.name,
userId: data.userId,
grade:data.grade,
inviteCode:data.inviteCode,
};
setStorageFun(USER_DATA,userInfo);
// 当前登录得时间戳
let currentTimeStamp = new Date().getTime();
setStorageFun(USER_LOGIN_TIME,currentTimeStamp);
this.$refs.uToastRef.show({
type: 'success',
message: resp.msg,
});
setTimeout(()=>{
uni.switchTab({
url: '/pages/home/home',
})
},2000);
}
this.butLoading = false;
},
/**
* 获取手机验证码
*/
getMobileCode(){
async getMobileCode(){
const form = this.form;
if(!form.mobile){
this.$refs.uToastRef.show({
type: 'error',
message: "请输入手机号码",
});
return;
}
this.countdown = true;
// const form = this.form;
// const params={
// mobile:form.mobile,
// type:SMS_TYPE.LOGIN,
// }
// const response = await uni.$http.post(smsCode,params);
// if(response && response.code === 0){
// this.startCountdown = true;
// this.$refs.uToastRef.show({
// type: 'success',
// message: response.msg,
// });
// }else{
// this.startCountdown = false;
// }
const params={
mobile:form.mobile,
type:SMS_TYPE.REGISTER,
}
const response = await getUserList(params);
if(response && response.bizcode === 100){
this.$refs.uToastRef.show({
type: 'success',
message: response.msg,
});
}else{
this.countdown = false;
}
},
getCode(val){
this.countdown = false;
// const emptyCountdown = this.emptyCountdown;
// if(val){
// const codeNumber = this.codeNumberRef;
// if(codeNumber){
// this.$emit('getCode');
// }else{
// this.$refs.uToastRef.show({
// type: 'error',
// message: "请输入邮箱",
// });
// return;
// }
// }else{
// this.$refs.uToastRef.show({
// type: 'error',
// message: "请输入邮箱",
// });
// }
},
}
}
</script>
+32 -7
View File
@@ -12,7 +12,7 @@
'border-radius': '20rpx !important',
'width': '590rpx',
}"
v-model="searchVal"
v-model="form.keyword"
>
<template #prefix>
<up-image src="/static/common/search.png" width="20" height="20" bgColor="#f1f6ff00" @click="jumpHome"></up-image>
@@ -24,7 +24,7 @@
</view>
</view>
<!-- 历史搜索 -->
<view class="search_history" v-if="!searchVal">
<view class="search_history" v-if="!poductList || poductList.length === 0">
<view class="search_history_title">
<view>历史搜索</view>
<up-image src="/static/common/delete.png" width="20" height="20" bgColor="#f1f6ff00" @click="isShowSearch = true;"></up-image>
@@ -123,12 +123,25 @@
name:'会心一笑',
},
],// 搜索历史记录
form:{
keyword:null,
type:null,
categoryId:null,//
page:1,
pageSize:20,
},
isShowSearch:false,
searchVal:null,
poductList:[],// 产品列表
imgSize:"min",// big:大,min:笑
}
},
onLoad(option) {
const id = option.categoryId;
if(id && id !==0){
this.form.categoryId = id;
this.searchClickFun();
}
},
methods: {
jumpHome(){
uni.switchTab({
@@ -145,17 +158,29 @@
* 查询产品
*/
async searchClick(item){
this.searchVal = item.name;
this.form.keyword = item.name;
this.searchClickFun();
},
/**
* 查询产品
*/
async searchClickFun(){
const param = {
keyword:this.searchVal,
const form = this.form;
const params = {
page:form.page,
pageSize:form.pageSize,
}
const resp = await searchList(param);
if(form.categoryId){
params.categoryId = form.categoryId;
}
if(form.keyword){
params.keyword = form.keyword;
}
if(form.type){
params.type = form.type;
}
const resp = await searchList(params);
if(resp && resp.bizcode === 100){
this.poductList = resp.data;
}
+67 -11
View File
@@ -8,6 +8,7 @@
<view class="enit_but" @click="isEdit = true">编辑</view>
</view>
<!-- 购物车列表 -->
<up-loading-page :loading="listLoading"></up-loading-page>
<view
class="shopping_cart_content"
>
@@ -22,10 +23,11 @@
activeColor="#FF7C41"
size="19"
iconSize="18"
@change="(event)=>shoppingChange(event,index)"
>
<template #label>
<view class="content_item_header">
<up-image :src="item.shopLogo ?item.shopLogo :'/static/shopping/store.png'" width="22" height="22" bgColor="#f1f6ff00"></up-image>
<up-image :src="item.shopLogo ?item.shopLogo :'/static/shopping/store.png'" width="22" height="22" bgColor="#f1f6ff00" shape="circle"></up-image>
<view class="order_product_title">{{item.shopName}}{{item.id}}</view>
</view>
</template>
@@ -43,9 +45,10 @@
size="19"
iconSize="18"
:disabled="!pItem.isAvail"
@change="(event)=>productChange(event,index,pIndex)"
>
</up-checkbox>
<view class="info_item">
<view class="info_item" @click="jumpInfo(pItem)">
<up-image :src="pItem.mainGraph" width="100" height="100" bgColor="#f1f6ff00"></up-image>
<view class="content_info">
<view class="shopping_content_info_title">{{pItem.name}}</view>
@@ -101,13 +104,13 @@
</up-checkbox>
<text style="margin-left: 20rpx;font-size: 24rpx;color: #444444;">合计:</text>
<text style="font-size: 24rpx;">¥</text>
<text style="font-size: 32rpx;">2000.00</text>
<text style="font-size: 32rpx;">{{total}}</text>
</view>
<view v-if="isEdit" class="delete_but_css" @click="deleteShopping">
删除
</view>
<view v-else class="add_but_css" @click="settleShopping">
结算(2)
结算({{count}})
</view>
</view>
</view>
@@ -131,9 +134,12 @@
shoppingList:[],// 购物车列表
isEdit:false,// 是否编辑
isAll:false,// 是否全选
total:0,// 总合计的金额
count:0,// 总条数
listLoading:false,
}
},
mounted() {
onLoad() {
this.getCartList();
},
methods: {
@@ -141,6 +147,7 @@
* 查询购物车列表
*/
async getCartList(){
this.listLoading = true;
const resp = await getCartList();
if(resp && resp.bizcode === 100){
// 处理了后的数据
@@ -148,14 +155,14 @@
this.shoppingTotal = resp.data.length;
this.shoppingList = data;
}
this.listLoading = false;
},
// 处理购物车的数据
transformedArray(originalArray){
const newOriginalArray = [];
originalArray.map(curr=>{
console.log("currcurrcurrcurr",curr);
const existingShop = newOriginalArray.find(shop => shop.shopId === curr.shopId && shop.shopName === curr.shopName);
if (existingShop) {
// 如果商店已存在,则向 productObj 数组中添加新产品对象
existingShop.product.push({
@@ -193,7 +200,6 @@
});
}
})
return newOriginalArray;
},
/**
@@ -232,7 +238,6 @@
* 结算订单
*/
settleShopping(){
console.log("结算订单....")
const deleteId = this.getCheckList();
if(!deleteId || deleteId.length === 0){
this.$refs.uToastRef.show({
@@ -241,11 +246,11 @@
});
return;
}
this.isAll = false;
this.selectCheck(false);
uni.navigateTo({
url:"/pages/order_submit/order_submit?ids="+deleteId.join(","),
})
this.isAll = false;
this.selectCheck(false);
},
/**
* 删除选中的
@@ -334,6 +339,56 @@
})
this.shoppingList = currentShoppingList;
},
/**
* 商品详情
* @param {Object} item
*/
jumpInfo(item){
console.log("item",item);
uni.navigateTo({
url:'/pages/productInfo/productInfo?id='+item.goodsId,
})
},
// 单个产品的单选按钮选中与取消选中
productChange(val,index,pIndex){
let total = this.total;
let count = this.count;
const data = this.shoppingList[index].product[pIndex];
if(val){
total = total + data.buyNum * data.unitPrice;
count = count + data.buyNum;
}else{
total = total - data.buyNum * data.unitPrice;
count = count - data.buyNum;
}
this.total = total;
this.count = count;
},
// 单个店铺的单选按钮选中与取消选中
shoppingChange(val,index){
let total = this.total;
let count = this.count;
const data = this.shoppingList[index];
data.product.map(item=>{
if(val){
item.isCheck = true;
total = total + item.buyNum * item.unitPrice;
count = count + item.buyNum;
}else{
item.isCheck = false;
total = total - item.buyNum * item.unitPrice;
count = count - item.buyNum;
}
})
this.shoppingList[index] = data;
this.total = total;
this.count = count;
},
}
}
</script>
@@ -380,6 +435,7 @@
}
.content_info{
margin-left: 10rpx;
width: calc(100% - 100rpx);
}
.shopping_content_info_title{
font-weight: bold;
+74 -13
View File
@@ -1,6 +1,7 @@
<template>
<view class="sort_warp">
<view class="sort_header">
<!-- 分类切换 -->
<view class="sort_category_header">
<view :class="selCategory === 1 ? 'category_item category_item_sel':'category_item'" @click="checkCategory(1)">
<view>分类</view>
@@ -11,6 +12,7 @@
<view v-if="selCategory === 2" class="category_item_sel_but"></view>
</view>
</view>
<!-- 搜索 -->
<view style="width: 200rpx;" @click="jumpSearch">
<up-search
shape="square"
@@ -22,14 +24,17 @@
</view>
</view>
<view class="u-menu-wrap">
<!-- 左侧类别 -->
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop">
<view v-for="(item,index) in tabbar" :key="index" class="u-tab-item" :class="[current==index ? 'u-tab-item-active' : '']"
:data-current="index" @tap.stop="swichMenu(index)">
<view v-for="(item,index) in tabbarList" :key="index" class="u-tab-item" :class="[current==index ? 'u-tab-item-active' : '']"
:data-current="index" @tap.stop="swichMenu(item,index)">
<text class="u-line-1">{{item.name}}</text>
</view>
</scroll-view>
<block v-for="(item,index) in tabbar" :key="index">
<scroll-view scroll-y class="right-box" v-if="current==index">
<!-- 商品类别数据 -->
<block>
<scroll-view scroll-y class="right-box">
<!-- banner图 -->
<view style="padding: 0rpx 20rpx;">
<up-swiper
:list="bannerList"
@@ -37,16 +42,27 @@
></up-swiper>
</view>
<view class="page-view">
<view class="class-item">
<!-- 这里还有一层循环 -->
<up-loading-page :loading="tabbarContentLoading"></up-loading-page>
<view class="class-item" v-for="(item,index) in tabbarContentList" :key="index">
<view class="item-title">
<text>{{item.name}}</text>
</view>
<view class="item-container">
<view class="thumb-box" v-for="(item1, index1) in item.foods" :key="index1">
<image class="item-menu-image" :src="item1.icon" mode=""></image>
<view class="item-container" v-if="item.foods && item.foods.length !==0">
<view
class="thumb-box"
v-for="(item1, index1) in item.foods"
:key="index1"
@click="jumpProduct(item1)"
>
<image class="item-menu-image" :src="item1.icon?item1.icon:'/static/common/def_img.jpg'" mode=""></image>
<view class="item-menu-name">{{item1.name}}</view>
</view>
</view>
<view v-else class="not_order_warp">
<view class="not_order_warp_img"><up-image src="/static/common/not_shopping.png" width="100" height="100" bgColor="#f1f6ff00"></up-image></view>
<view class="not_order_msg_warp">暂无分类,快去添加吧~</view>
</view>
</view>
</view>
</scroll-view>
@@ -57,6 +73,7 @@
<script>
import classifyData from '@/common/classify.data.js';
import { getCascadeCategory } from '@/api/common.js';
export default {
data() {
@@ -64,12 +81,29 @@
selCategory:1,
tabbar: classifyData,
scrollTop: 0, //tab标题的滚动条位置
current: 0, // 预设当前项的值
current: null, // 预设当前项的值
menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度
bannerList:['/static/common/product_def_banner.png','/static/common/product_def_banner.png','/static/common/product_def_banner.png'],
bannerList:[
'/static/common/product_def_banner.png',
'/static/common/product_def_banner.png',
'/static/common/product_def_banner.png'
],
tabbarList:[],// 左侧的主分类
tabbarContentList:[],// 右侧内容的分类
tabbarContentLoading:false,
}
},
mounted() {
const then = this;
this.getSort(0).then(resp=>{
if(resp && resp.length !==0){
const fData = resp[0];
this.tabbarList = resp;
this.swichMenu(fData,0);
}
});
},
methods: {
checkCategory(val){
this.selCategory = val;
@@ -79,12 +113,30 @@
url:'/pages/search/search',
})
},
// 查询分类
async getSort(pId){
const params = {
parentId:pId,
}
const resp = await getCascadeCategory(params);
if(resp && resp.bizcode === 100){
return resp.data;
}
return [];
},
getImg() {
return Math.floor(Math.random() * 35);
},
// 点击左边的栏目切换
async swichMenu(index) {
async swichMenu(item,index) {
if(index == this.current) return ;
this.tabbarContentLoading = true;
const firstData = await this.getSort(item.id);
for(let fItem of firstData){
const twoData = await this.getSort(fItem.id);
fItem.foods = twoData;
}
this.tabbarContentList = firstData;
this.current = index;
// 如果为0,意味着尚未初始化
if(this.menuHeight == 0 || this.menuItemHeight == 0) {
@@ -93,7 +145,9 @@
}
// 将菜单菜单活动item垂直居中
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2;
this.tabbarContentLoading = false;
},
// 获取一个目标元素的高度
getElRect(elClass, dataVal) {
new Promise((resolve, reject) => {
@@ -109,6 +163,12 @@
this[dataVal] = res.height;
}).exec();
})
},
// 跳转到搜索页面
jumpProduct(item){
uni.navigateTo({
url:'/pages/search/search?categoryId='+item.id,
})
}
}
}
@@ -236,6 +296,7 @@
font-weight: normal;
font-size: 24rpx;
color: $u-main-color;
margin-top: 10rpx;
}
.item-container {
@@ -253,7 +314,7 @@
}
.item-menu-image {
width: 120rpx;
height: 120rpx;
width: 110rpx;
height: 110rpx;
}
</style>
+100 -9
View File
@@ -17,9 +17,29 @@
</view>
</view>
<!-- <view><q-turntable ref="turntable" @start="turntableStart" @success="turntableSuccess"></q-turntable></view> -->
<!-- 抽奖次数 -->
<view class="draws_warp">
<view class="draws_item_warp" @click="drawsFun(1)">抽1次</view>
<view class="draws_item_warp" @click="drawsFun(10)">抽10次</view>
<view class="draws_item_warp" @click="drawsFun(100)">抽100次</view>
<view class="draws_item_warp" @click="drawsFun(365)">抽356次</view>
</view>
</view>
</view>
<!-- 活动规则 -->
<view class="rule">
<view class="rule_title">
<view class="title">活动规则</view>
</view>
<view class="rule_content">内容XXXXXXXXXXXXXXXXXXXXXXXX</view>
</view>
</view>
<!-- 中奖记录 -->
<view class="winning_record">
<view style="margin-top: 10rpx;">
<up-image src="/static/turntable/record.png" width="14" height="14" bgColor="#f1f6ff00" @click="jumpWinningRecord"></up-image>
</view>
<view style="margin-left: 10rpx;">中奖记录</view>
</view>
</view>
</template>
@@ -29,8 +49,7 @@
data() {
return {
deg: 0,
singleAngle: '',
// 每片扇形的角度
singleAngle: '',// 每片扇形的角度
isStart: false,
areaNumber:6,
speed:16,
@@ -118,12 +137,6 @@
this.deg = deg;
}, 1000 / 60);
},
// 用户点击开始抽奖
// turntableStart() {
// let index = Math.floor(Math.random() * 6 + 1) //前端随机数,这里应该后台返回中奖结果
// this.award = index
// this.$refs.turntable.begin(this.award);
// },
// 抽奖完成后操作
turntableSuccess() {
@@ -134,6 +147,19 @@
icon: 'none'
});
},
/**
* 开始多次抽奖
*/
drawsFun(count){
console.log("开始多次抽奖。。count",count);
this.start();
},
/**
* 跳转到中奖记录
*/
jumpWinningRecord(){
}
}
}
</script>
@@ -141,6 +167,7 @@
<style lang="scss">
.turntable_warp{
height: 100vh;
position: relative;
}
.turntable_header_warp{
height: 1200rpx;
@@ -172,14 +199,63 @@
background-position: center; /* 将图片居中显示 */
width: 100%;
height: 820rpx;
position: relative;
}
.draws_warp{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 0 84rpx;
position: absolute;
top: 576rpx;
width: calc(100% - 168rpx);
.draws_item_warp{
width:40%;
text-align: center;
background: #FE2F32;
border-radius: 16rpx;
border: 2px solid #FFC8C8;
margin-bottom: 20rpx;
color: #ffffff;
padding: 20rpx 0rpx;
}
}
}
.rule{
background: #FFFFFF;
border-radius: 50rpx 50rpx 0rpx 0rpx;
min-height:500rpx;
padding: 30rpx;
.rule_title{
display: flex;
justify-content: center;
margin-bottom: 30rpx;
.title{
background: #FF2524;
border-radius: 30rpx 0rpx 40rpx 0rpx;
color:#FFFFFF;
padding: 10rpx 0;
width: 280rpx;
text-align: center;
font-size: 40rpx;
}
}
.rule_content{
font-weight: 400;
font-size: 28rpx;
color: #999999;
line-height: 38rpx;
}
}
}
.turntable_wp {
width: 610rpx;
height: 610rpx;
position: relative;
margin: 0 auto;
top: -176rpx;
}
.turntable_wp image {
display: block;
@@ -194,4 +270,19 @@
left: 50%;
margin: -125rpx 0 0 -112rpx;
}
.winning_record{
position: absolute;
right: 0rpx;
top: 200rpx;
background: rgba(92, 0, 1, 0.5);
border-radius: 30rpx 0rpx 0rpx 30rpx;
display: flex;
align-items: center;
color: #FFFFFF;
padding: 10rpx 20rpx;
font-weight: 500;
font-size: 25rpx;
color: #FBFAFA;
}
</style>
+37 -65
View File
@@ -16,26 +16,27 @@
<view class="msg">款款都是爆款</view>
</view>
<view class="preference_product">
<view class="product_item" v-for="item in productList">
<up-loading-page :loading="productListLoading"></up-loading-page>
<view class="product_item" v-for="(item,index) in productList" :key="index" @click="jumpInfo(item)">
<view class="product_item_left">
<up-image :src="item.url" width="100" height="100" bgColor="#f1f6ff00"></up-image>
<view class="product_item_left_bz product_item_left_bz_img" v-if="item.type === 1">
<view class="product_item_left_bz product_item_left_bz_img">
<view>爆款专区</view>
</view>
</view>
<view class="product_item_right">
<view class="title_warp">{{item.name}}</view>
<view class="title_warp">{{item.title}}</view>
<view class="price_warp">
<view class="price_o_warp">
<view class="price_o_title_warp">原价</view>
<view class="price_o_value_warp">
<text>¥</text>
<text>{{item.oPrice}}</text>
<text>{{item.adPrice}}</text>
</view>
</view>
<view class="price_zq_warp">
<view class="price_lj_warp">专区立省{{item.zqPrice}}元</view>
<view class="price_ds_warp">到手¥<text style="font-size: 31rpx;">{{item.price}}</text></view>
<view class="price_lj_warp">专区立省{{item.adPrice}}元</view>
<view class="price_ds_warp">到手¥<text style="font-size: 31rpx;">{{item.adPrice}}</text></view>
</view>
</view>
</view>
@@ -46,73 +47,22 @@
</template>
<script>
import { searchList } from '@/api/product.js';
import { SEARCH_TYPE } from '@/utils/enumUtils.js';
export default {
data() {
return {
swiperList:[
'/static/home/banner03.png',
],
productList:[
{
id:1,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:1,// 1:爆款区的 0:普通区
},{
id:2,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:0,
},{
id:3,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:0,
},{
id:4,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:1,
},{
id:5,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:0,
},{
id:6,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:0,
},{
id:7,
name:"Michael Kors I Jodie 老花狗牙托特包手提单肩包-小号...",
url:"/static/common/product_def.png",
zqPrice:42.84,// 专区价格
price:424.84,// 到手价格
oPrice:466.84,// 原价价格
type:0,
},
]
productList:[],
productListLoading:false,
}
},
onLoad() {
this.getSearchList();
},
methods: {
jumpHome(){
uni.switchTab({
@@ -125,6 +75,28 @@
url: '/pages/invite_friends/invite_friends',
})
},
async getSearchList(){
this.productListLoading = true;
const params = {
type:SEARCH_TYPE.EXPLOSIVE,
page:1,
pageSize:99,
}
const resp = await searchList(params);
if(resp && resp.bizcode === 100){
this.productList = resp.data;
}
this.productListLoading = false;
},
/**
* 跳转到商品详情
* @param {Object} item
*/
jumpInfo(item){
uni.navigateTo({
url: '/pages/productInfo/productInfo?id='+item.id,
})
}
}
}
</script>