Browse Source

我的订单 商品详情 首页专题列表 专题详情 我的推荐列表 取消收藏 添加收藏 商品列表接口

test
Enzo 5 years ago
parent
commit
14483493c2
  1. 2
      App.vue
  2. 10
      common/api.js
  3. 4
      common/http.js
  4. 8
      components/lf-waterfall/lf-waterfall.vue
  5. 43
      pages/activityList/index.vue
  6. 106
      pages/collect/index.vue
  7. 104
      pages/goodsDetail/index.vue
  8. 34
      pages/goodsList/index.vue
  9. 33
      pages/index/index.vue
  10. 4
      pages/message/index.vue
  11. 125
      pages/order/order.vue
  12. 107
      pages/user/user.vue

2
App.vue

@ -11,7 +11,7 @@
onLaunch: function() {
this.disableConsole();
this.getSystemInfo();
// this.getUserInfo();
this.getUserInfo();
},
onShow: function() {
// #ifdef MP-WEIXIN

10
common/api.js

@ -22,14 +22,24 @@ export const API_ADVICELIST = '/api/agent_product/list'; //推荐列表
export const API_CATEGORYLIST = '/api/category/list'; //推荐分类
export const API_ADVICEDETAILS = '/api/agent_product/show'; //推荐列表详情
export const API_PRODUCTLIST = '/api/channel/product'; //频道产品列表
export const API_SPECIALLIST = '/api/special/show'; //专题列表
export const API_MESSAGELIST = '/api/message/list'; //消息列表
export const API_MESSAGEDETAILS = '/api/message/show'; //消息详情
export const API_CHECKNEWS = '/api/message/read'; //消息标记为已读
export const API_RECOMMOND = '/api/agent_product/recommend'; //我的推荐列表
//订单
export const API_ORDERLIST = '/api/order/list'; //订单列表
//系统
export const API_ABOUTUS = '/api/agent_info/about'; //关于我们
export const API_COLLECT_LIST = '/api/fav/list'; //收藏列表
export const API_ADDCOLLECT = '/api/fav/create'; //添加收藏
export const API_DELCOLLECT = '/api/fav/delete'; //删除收藏

4
common/http.js

@ -92,7 +92,9 @@ function $http(url, data = {}, options = {}){
//商户id
options.appid = 'wx0e8ebcd9ca9e4b97'
options.Authentication = 'c4ca4238a0b923820dcc509a6f75849b'
let user_info = uni.getStorageSync('userinfo')
let user_token = user_info.token
options.Authentication = user_token
// 发起请求
that.$u.post(url, data, options).then(res => {
resolve(res);

8
components/lf-waterfall/lf-waterfall.vue

@ -2,7 +2,7 @@
<view>
<u-waterfall v-model="list">
<template v-slot:left="{leftList}">
<view class="list-warter" v-for="(item, index) in leftList" :key="index" @click="onClick">
<view class="list-warter" v-for="(item, index) in leftList" :key="index" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
@ -19,7 +19,7 @@
</view>
</template>
<template v-slot:right="{rightList}">
<view class="list-warter" v-for="(item, index) in rightList" :key="index" @click="onClick">
<view class="list-warter" v-for="(item, index) in rightList" :key="index" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
@ -56,9 +56,9 @@
},
methods: {
onClick(){
onClick(id){
console.log("aaaa");
this.$url('/pages/goodsDetail/index');
this.$url('/pages/goodsDetail/index?goods_id='+id);
this.$emit('click');
}
}

43
pages/activityList/index.vue

@ -2,22 +2,22 @@
<view>
<!-- 图片轮播 -->
<swiper :current="current" :indicator-dots="banners.length > 1 ? true : false" :circular="true" class="swiper-box" indicator-active-color="#1998FE">
<swiper-item v-for="(item, index) in banners" :key="item.id">
<image mode="aspectFill" :src="item.cover" style="width: 100%; height: 100%;" @click="lookImg(index)"></image>
<swiper-item v-for="(item, index) in banners" :key="index">
<image mode="aspectFill" :src="item" style="width: 100%; height: 100%;" @click="lookImg(index)"></image>
</swiper-item>
</swiper>
<!-- 活动列表 -->
<view class="content">
<view class="item" v-for="item in list" :key="item">
<view class="cover">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100" mode="aspectFill"></image>
<view class="item" v-for="(item,index) in list" :key="index">
<view class="cover" @click="enterDetail(index)">
<image :src="item.product.picture" class="lf-w-100 lf-h-100" mode="aspectFill"></image>
</view>
<view style="width: 420rpx;">
<view class="lf-font-28 lf-color-333 lf-m-b-20 lf-line-2" style="height: 78rpx;">南胜地 身处亚热带风情/玩转南澳转南澳转南澳转南澳转转南澳转南澳</view>
<view class="lf-font-28 lf-color-333 lf-m-b-20 lf-line-2" style="height: 78rpx;">{{item.product.title}}</view>
<view class="lf-font-24 lf-color-gray">本套票只包含两个成人不可带小孩</view>
<view class="lf-flex lf-m-t-25">
<lf-price price="3599.00"></lf-price>
<text class="lf-font-24 lf-color-gray lf-line-through lf-m-l-15">¥4599.00</text>
<lf-price :price="item.price"></lf-price>
<text class="lf-font-24 lf-color-gray lf-line-through lf-m-l-15">¥{{item.original_price}}</text>
</view>
</view>
</view>
@ -38,22 +38,24 @@
return {
current: 0,
banners: [{id: 1, cover: 'https://picsum.photos/375/490'}],
list: [1,2,3,4,5],
list: [],
loadingClass: false,
loadingText: '已加载全部数据~',
page: 1,
isPage: true,
pageSize: 20
pageSize: 20,
special_id: 0
}
},
onLoad(){
// this.getActivityList();
onLoad(e){
this.special_id = e.special_id
this.getActivityList();
},
methods: {
lookImg(index){
this.$u.throttle(() => {
let goods_banner = this.banners || [];
let banners = goods_banner.map(item => item.cover);
let banners = goods_banner.map(item => item);
uni.previewImage({
urls: banners,
current: index
@ -61,11 +63,12 @@
}, 200);
},
getActivityList(){
return;
this.$http(this.API.a).then(res => {
this.isPage = res.data.has_more_page;
let list = res.data.items;
if(!res.data.has_more_page){
this.$http(this.API.API_SPECIALLIST,{id:this.special_id}).then(res => {
let isPage = res.data.next_page_url == null?false:true;
this.isPage = isPage;
let list = res.data.product
this.banners = res.data.picture
if(!isPage){
this.loadingClass = false;
this.loadingText = '已加载全部数据~';
}
@ -78,8 +81,8 @@
},
//
enterDetail(index){
let goods_id = this.list[index].goods_id;
this.$url('/pages/goodsDetail/index?id='+ goods_id);
let goods_id = this.list[index].id;
this.$url('/pages/goodsDetail/index?goods_id='+ goods_id);
}
},
onReachBottom(){

106
pages/collect/index.vue

@ -2,16 +2,16 @@
<view>
<view class="list-box">
<view class="lf-row-between list-item" v-for="(item, index) in list" :key="item.id">
<image class="goods-img" mode="aspectFill" :src="item.goods.cover" @click="enterDetail(index)"></image>
<image class="goods-img" mode="aspectFill" :src="item.product.picture" @click="enterDetail(item.id)"></image>
<view style="width: 458rpx;">
<view class="lf-font-28 lf-line-2" style="height: 80rpx;" @click="enterDetail(index)">{{ item.goods.name }}</view>
<view class="lf-m-t-15 lf-font-24 lf-color-gray">{{ item.created_at_text }}</view>
<view class="lf-font-28 lf-line-2" style="height: 80rpx;" @click="enterDetail(item.id)">{{ item.product.title }}</view>
<view class="lf-m-t-15 lf-font-24 lf-color-gray">{{ timer(item.created_at*1000) || '' }}</view>
<view class="lf-row-between lf-m-t-20">
<lf-price price="3599.00"></lf-price>
<view class="lf-row-center collect-btn" :class="{'cancel': index == 1}">
<text class="lf-iconfont lf-icon-dui1 lf-m-r-1" v-if="index != 1"></text>
<text>{{ index == 1 ? '收藏' : '已收藏' }}</text>
<view class="lf-row-center collect-btn" @click="switchCollect(index,item.is_collect)" :class="{'cancel': !item.is_collect}">
<text class="lf-iconfont lf-icon-dui1 lf-m-r-1" v-if="item.is_collect"></text>
<text>{{ !item.is_collect ? '收藏' : '已收藏' }}</text>
</view>
</view>
@ -46,28 +46,20 @@
},
methods: {
getCollectList(){
// this.list = [{
// id: 1,
// goods: {cover: '', name: '', store: {name: ''}},
// is_collect: true,
// created_at_text: '2021.07.07'
// },{
// id: 2,
// goods: {cover: '', name: '', store: {name: ''}},
// is_collect: true,
// created_at_text: '2021.07.07'
// }];
// return;
this.$http(this.API.API_COLLECT_LIST).then(res => {
this.$http(this.API.API_COLLECT_LIST,{page: this.page}).then(res => {
this.skeletonLoading = false;
this.isPage = res.data.has_more_page;
let isPage = res.data.next_page_url == null?false:true;
this.isPage = isPage;
console.log(res)
let list = res.data.items.map(item => {
item.is_collect = true; //
return item;
});
if(!res.data.has_more_page){
// let list = res.data.map(item => {
// item.is_collect = true; //
// return item;
// });
let list = res.data.data
res.data.data.forEach((item,index) => {
this.$set(list[index],'is_collect',true)
})
if(!isPage){
this.loadingClass = false;
this.loadingText = '已显示全部数据~';
}
@ -76,22 +68,66 @@
}else{
this.list.push(...list);
}
console.log('列表',this.list)
}).catch(err => {
this.skeletonLoading = false;
})
},
//
switchCollect(index){
let goods_id = this.list[index].goods_id;
this.$http(this.API.API_COLLECT_DEAL, {goods_id}).then(res => {
this.list[index].is_collect = Boolean(res.data.user.is_collect);
})
switchCollect(index,if_collect){
let goods_id = this.list[index].id;
if(if_collect) {
this.$http(this.API.API_DELCOLLECT, {id:goods_id}).then(res => {
this.$msg('取消收藏成功!')
console.log(res)
this.list[index].is_collect = false;
})
}else {
this.$http(this.API.API_ADDCOLLECT, {id:goods_id}).then(res => {
this.$msg('添加收藏成功!')
console.log(res)
this.list[index].is_collect = true;
})
}
},
//
enterDetail(index){
let goods_id = this.list[index].goods_id;
this.$url('/pages/goodsDetail/index?id='+ goods_id);
}
enterDetail(id){
this.$url('/pages/goodsDetail/index?goods_id='+ id);
},
timer(value, fmt) {
if(!value) return;
let newTime = new Date(value)
if(!fmt){
fmt = 'yyyy-MM-dd hh:mm';
}
if(/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (newTime.getFullYear() + '').substr(4 - RegExp.$1.length));
}
let o = {
'M+': newTime.getMonth() + 1,
'd+': newTime.getDate(),
'h+': newTime.getHours(),
'm+': newTime.getMinutes(),
's+': newTime.getSeconds()
};
function padLeftZero(str) {
return ('00'+str).substr(str.length);
}
//
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
// console.log(`${k}`)
let str = o[k] + '';
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
}
}
return fmt;
},
},
onReachBottom(){
if(this.isPage){

104
pages/goodsDetail/index.vue

@ -1,29 +1,30 @@
<template>
<view>
<skeleton :loading="skeletonLoading" :row="12" :showAvatar="false" :showTitle="true">
<block v-if="$isRight(goods_detail)">
<block v-if="isRight(goods_detail)">
<!-- 商品图片轮播 -->
<swiper :current="current" :indicator-dots="goods_detail.banners.length > 1 ? true : false" :circular="true" class="swiper-box" indicator-active-color="#1998FE">
<swiper-item v-for="(item, index) in goods_detail.banners" :key="item.id">
<image mode="aspectFill" :src="item.cover" style="width: 100%; height: 100%;" @click="lookImg(index)"></image>
<swiper :current="current" :indicator-dots="goods_detail.product.pictures.length > 1 ? true : false" :circular="true" class="swiper-box" indicator-active-color="#1998FE">
<swiper-item v-for="(item, index) in goods_detail.product.pictures" :key="index">
<image mode="aspectFill" :src="item" style="width: 100%; height: 100%;" @click="lookImg(index)"></image>
</swiper-item>
</swiper>
<!-- 商品主要信息 -->
<view class="head-info">
<view class="lf-font-32 lf-color-333 lf-font-bold">{{ goods_detail.name }}</view>
<view class="lf-font-32 lf-color-333 lf-font-bold">{{ goods_detail.product.title }}</view>
<view class="lf-row-between lf-font-24 lf-m-t-30 lf-p-b-20">
<view class="lf-flex price">
<lf-price :price="goods_detail.specs[0].selling_price"></lf-price>
<view class="lf-m-l-20">¥{{ goods_detail.specs[0].original_price }}</view>
<view v-if="goods_detail.specs[0].cost">{{ goods_detail.specs[0].cost }}</view>
<lf-price :price="goods_detail.price"></lf-price>
<view class="lf-m-l-20">¥{{ goods_detail.original_price }}</view>
<view v-if="goods_detail.cost">{{ goods_detail.cost }}</view>
</view>
<view class="lf-font-24 lf-text-right">
<view class="lf-color-gray">{{ goods_detail.specs[0].sold_stock_text }}</view>
<view class="lf-color-gray">已售 {{ goods_detail.sale }}</view>
<view class="lf-color-gray">库存 {{ goods_detail.product.stock }}</view>
<!-- <view class="lf-color-primary">{{ goods_detail.specs[0].stock_text }}</view> -->
</view>
</view>
<view class="label-box" v-if="goods_detail.tags && goods_detail.tags.length">
<view class="label-item" v-for="(item, index) in goods_detail.tags" :key="index">{{ item }}</view>
<view class="label-box" v-if="goods_detail.coupon && goods_detail.coupon.length">
<view class="label-item" v-for="(item, index) in goods_detail.coupon" :key="index">{{ item.tag }}</view>
</view>
</view>
<!-- 地址信息 -->
@ -49,9 +50,9 @@
<!-- 商品详情 -->
<view class="goods-detail">
<view class="lf-font-32 lf-font-bold lf-m-b-20">旅游须知</view>
<rich-text :nodes="formatRichText(goods_detail.content)" v-if="goods_detail.content_type == 'rich_text'"></rich-text>
<image class="goods-img" :src="item" v-for="(item, index) in goods_detail.content" :key="index" v-if="goods_detail.content_type == 'img'"></image>
</view>
<rich-text :nodes="formatRichText(goods_detail.product.know)"></rich-text>
<!-- <image class="goods-img" :src="item" v-for="(item, index) in goods_detail.content" :key="index" v-if="goods_detail.content_type == 'img'"></image> -->
</view>
<!-- 修饰专用 -->
<view class="extra"></view>
<!-- 吸底操作按钮 -->
@ -97,74 +98,28 @@
}
},
onLoad(options){
this.goods_id = options.id;
this.goods_id = options.goods_id;
console.log('商品',this.goods_id)
this.getGoodsDetail();
},
computed: {
isRight() {
return function(val) {
return this.$shared.isRight(val);
}
}
},
methods: {
getGoodsDetail(){
let that = this;
this.goods_detail = {
all_specs: null,
banners: [],
category_id: 2,
content: "<p><img src='http://sky-applet-mall.oss-cn-shenzhen.aliyuncs.com/tinymce/images/156005c5baf40ff51a327f1c34f2975b60dd6a468cdbe.jpg' alt='' width='100%' /></p>",
content_type: "rich_text",
cover: "http://sky-applet-mall.oss-cn-shenzhen.aliyuncs.com/images/d1c990182d6cfd6ebf1faf4077f22248.jpg!thumb_300x300_q90",
created_at: "1625123492",
deleted_at: null,
id: 1,
name: "肯德基精选午餐",
share_cover: "http://sky-applet-mall.oss-cn-shenzhen.aliyuncs.com/images/d1c990182d6cfd6ebf1faf4077f22248.jpg",
specs: [{
cost: "",
created_at: "1625470217",
deleted_at: null,
goods_id: 1,
id: 8,
limit: 10,
name: "规格3",
original_price: "111.00",
original_price_text: "111.00",
selling_price: "1.00",
sold_percent: 50,
sold_percent_text: "已抢50%",
sold_stock: 110,
sold_stock_text: "110人购买",
specs: null,
state: 1,
stock: 110,
stock_text: "库存仅剩110份",
updated_at: "1625471139"
}],
store: {
address: "广西南宁市青秀区民族大道111号",
cover: "http://sky-applet-mall.oss-cn-shenzhen.aliyuncs.com/images/b4644c5226918153c0cb372e99e12bed.jpg!thumb_200x200_q90",
created_at: "1625122973",
deleted_at: null,
id: 1,
intro: null,
lat: "108.3745472970581",
lng: "22.813532837581967",
name: "肯德基连锁餐饮",
state: 2,
tel: "18888888888",
updated_at: "1625537146",
user_id: 7
},
store_id: 1,
tags: ["推荐"],
updated_at: "1625123492",
user: {is_collect: 1}
}
return;
this.$http(this.API.API_GOODS_DETAIL, {goods_id: this.goods_id}).then(res => {
this.$http(this.API.API_ADVICEDETAILS, {id: this.goods_id}).then(res => {
this.skeletonLoading = false;
this.goods_detail = res.data;
this.is_collect = Boolean(res.data.user.is_collect);
// this.is_collect = Boolean(res.data.user.is_collect) || false;
}).catch(err => {
this.skeletonLoading = false;
setTimeout(() => {
that.$toBack();
this.$toBack();
}, 1000);
})
},
@ -298,7 +253,8 @@
flex-wrap: wrap;
padding: 30rpx 0 10rpx 0;
.label-item{
width: 156rpx;
width: 162rpx;
// padding: 20rpx;
height: 70rpx;
border-radius: 10rpx;
border: 2rpx solid #1998FE;

34
pages/goodsList/index.vue

@ -2,16 +2,16 @@
<view>
<!-- 活动列表 -->
<view class="content">
<view class="item" v-for="item in list" :key="item">
<view class="item" v-for="(item,index) in list" :key="index">
<view class="cover">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100" mode="aspectFill"></image>
<image :src="item.product.picture" class="lf-w-100 lf-h-100" mode="aspectFill"></image>
</view>
<view style="width: 420rpx;">
<view class="lf-font-28 lf-color-333 lf-m-b-20 lf-line-2" style="height: 78rpx;">南胜地 身处亚热带风情/玩转南澳转南澳转南澳转南澳转转南澳转南澳</view>
<view class="lf-font-28 lf-color-333 lf-m-b-20 lf-line-2" style="height: 78rpx;">{{item.product.title}}</view>
<view class="lf-font-24 lf-color-gray">本套票只包含两个成人不可带小孩</view>
<view class="lf-flex lf-m-t-25">
<lf-price price="3599.00"></lf-price>
<text class="lf-font-24 lf-color-gray lf-line-through lf-m-l-15">¥4599.00</text>
<lf-price :price="item.price"></lf-price>
<text class="lf-font-24 lf-color-gray lf-line-through lf-m-l-15">¥{{item.original_price}}</text>
</view>
</view>
</view>
@ -30,24 +30,26 @@
export default {
data(){
return {
list: [1,2,3,4,5],
list: [],
loadingClass: false,
loadingText: '已加载全部数据~',
page: 1,
isPage: true,
pageSize: 20
pageSize: 20,
channel_id: 0
}
},
onLoad(){
// this.getActivityList();
onLoad(e){
this.channel_id = e.channel_id
this.getActivityList();
},
methods: {
getActivityList(){
return;
this.$http(this.API.a).then(res => {
this.isPage = res.data.has_more_page;
let list = res.data.items;
if(!res.data.has_more_page){
this.$http(this.API.API_PRODUCTLIST,{page:this.page,channel_id: this.channel_id}).then(res => {
let isPage = res.data.next_page_url == null?false:true;
this.isPage = isPage;
let list = res.data.data;
if(!isPage){
this.loadingClass = false;
this.loadingText = '已加载全部数据~';
}
@ -56,12 +58,14 @@
}else{
this.list.push(...list);
}
console.log(list)
})
},
//
enterDetail(index){
let goods_id = this.list[index].goods_id;
this.$url('/pages/goodsDetail/index?id='+ goods_id);
this.$url('/pages/goodsDetail/index?goods_id='+ goods_id);
}
},
onReachBottom(){

33
pages/index/index.vue

@ -23,7 +23,7 @@
</view>
</view>
<view class="lf-flex-wrap">
<view class="channel-item" v-for="(item, index) in channel_list" @click="$url('/pages/goodsList/index')">
<view class="channel-item" v-for="(item, index) in channel_list" @click="$url('/pages/goodsList/index?channel_id='+item.id)">
<image :src="item.icon" class="channel-mask" mode="aspectFill"></image>
<view class="lf-row-center channe-text lf-font-bold">{{item.name}}</view>
<!-- <view>
@ -32,22 +32,25 @@
</view>
</view>
<!-- 中间广告模块 -->
<swiper class="lf-m-t-40 ad" :current="banner_current" >
<view class="lf-m-t-40 ad" v-for="(item,index) of home_ad1" :key="index">
<image @click="clickAD(item.id)" :src="item.picture_ad" mode="aspectFill" class="lf-w-100 lf-h-100"></image>
</view>
<!-- <swiper class="lf-m-t-40 ad" :current="banner_current" >
<swiper-item @click="clickAD">
<image :src="home_ad1" class="lf-w-100 lf-h-100"></image>
</swiper-item>
</swiper>
</swiper> -->
<!-- 人气爆款 -->
<view class="lf-row-between lf-m-t-40">
<view class="lf-font-36 lf-font-bold lf-color-333">人气爆款</view>
<view class="lf-flex lf-color-555" @click="$url('/pages/activityList/index')">
<view class="lf-flex lf-color-555" @click="$url('/pages/goodsDetail/index')">
<view class="lf-m-r-10">更多</view>
<view class="lf-iconfont lf-icon-xiangyou lf-text-vertical"></view>
</view>
</view>
<view class="recomm lf-m-t-20 lf-m-b-30">
<view class="lf-row-between">
<view class="max-recomm-img" @click="$url('/pages/activityList/index')">
<view class="max-recomm-img" @click="$url('/pages/goodsDetail/index?goods_id='+hot_list[0].id)">
<image :src="hot_list[0].product.picture" class="lf-w-100 lf-h-100"></image>
<view class="recomm-title">
<view class="lf-line-2 lf-m-b-10">{{hot_list[0].product.title}}</view>
@ -56,16 +59,16 @@
</view>
</view>
<view>
<view class="recomm-img" @click="$url('/pages/activityList/index')">
<view class="recomm-img" @click="$url('/pages/goodsDetail/index?goods_id='+hot_list[1].id)">
<image :src="hot_list[1].product.picture" class="lf-w-100 lf-h-100"></image>
</view>
<view class="recomm-img lf-m-t-10" @click="$url('/pages/activityList/index')">
<view class="recomm-img lf-m-t-10" @click="$url('/pages/goodsDetail/index?goods_id='+hot_list[2].id)">
<image :src="hot_list[2].product.picture" class="lf-w-100 lf-h-100"></image>
</view>
</view>
</view>
<view class="lf-row-between lf-m-t-10">
<view class="recomm-img" @click="$url('/pages/activityList/index')" v-for="(item,index) of hot_list" v-if="index>2">
<view class="recomm-img" @click="$url('/pages/goodsDetail/index?goods_id='+item.id)" v-for="(item,index) of hot_list" v-if="index>2">
<image :src="item.product.picture" class="lf-w-100 lf-h-100"></image>
</view>
</view>
@ -118,7 +121,7 @@
loading_class: false,
hot_list: [],
loading_text: '已加载全部数据~',
home_ad1: '',
home_ad1: [],
hot_number: '',
list: [],
notice: []
@ -156,8 +159,9 @@
this.hot_number = parseInt(this.hot_list[0].price)
this.banner = res.data?.slide
this.channel_list = res.data?.my_channels
this.home_ad1 = res.data?.home_ad1
console.log(res)
this.home_ad1 = res.data?.special
uni.stopPullDownRefresh();
console.log(this.home_ad1)
}).catch(err => {
})
@ -176,15 +180,16 @@
this.$msg('您点击了banner图')
},
// ad
clickAD(){
this.$msg('您点击了ad广告')
clickAD(id){
// this.$msg('ad广')
this.$url('/pages/activityList/index?special_id='+id)
}
},
onReachBottom() {
},
onPullDownRefresh(){
uni.stopPullDownRefresh();
this.getIndexData()
},
onShareAppMessage(){
let shareInfo = {

4
pages/message/index.vue

@ -25,7 +25,7 @@
export default {
data(){
return {
list: [1, 2],
list: [],
loadingClass: true,
loadingText: '正在加载中',
page: 1,
@ -52,11 +52,9 @@
'm+': newTime.getMinutes(),
's+': newTime.getSeconds()
};
function padLeftZero(str) {
return ('00'+str).substr(str.length);
}
//
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {

125
pages/order/order.vue

@ -9,19 +9,19 @@
<swiper-item v-for="(tab, tabIndex) in tab_list" :key="tabIndex">
<scroll-view class="com" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher"
@scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh">
<view class="flex-direction justify-around list" @click="$url('/pages/order/order_details?order_id=1')">
<view class="flex-direction justify-around list" v-for="(item, index) in tab.list" :key="item.id" @tap="goDetails(tabIndex,index)">
<view class="lf-row-between">
<view class="left" style="position: relative;display: flex;">
<image src="../../static/logo.png" mode="aspectFill"></image>
<image :src="item.product.picture" mode="aspectFill"></image>
</view>
<view class="right">
<view class="lf-line-2 title lf-font-28 lf-color-333" style="line-height: 40rpx;">南澳站·潮玩旅游胜地 身处亚热带风情/玩转南澳</view>
<view class="lf-line-2 title lf-font-28 lf-color-333" style="line-height: 40rpx;">{{item.product.title}}</view>
<view class="lf-flex tips lf-m-t-10">
<text class="progress margin-right-xs lf-color-gray">数量</text>
<text class="bought lf-color-gray">x 1</text>
<text class="bought lf-color-gray">x {{item.num}}</text>
</view>
<view class="lf-row-between price lf-m-t-16" style="padding-right: 6rpx;">
<lf-price :price="599.00" style="margin-top: 10rpx;" />
<lf-price :price="item.price" style="margin-top: 10rpx;" />
<button class="lf-font-24 radius-order">立即付款</button>
<!-- <button class="cu-btn1 lf-color-green lf-border-green">立即使用</button> -->
@ -33,7 +33,7 @@
<view>
<view class="solid-top flex justify-between align-center text-center">
<view class="text-gray lf-font-28" style="padding: 20rpx;">
2021-7-6 23:24:46
{{timer(item.created_at*1000)}}
</view>
<view class="lf-color-price" style="padding: 20rpx 24rpx 20rpx 20rpx;">
请在10分钟内付款
@ -62,7 +62,7 @@
return {
tab_list: [{
name: '全部',
type: 'all',
type: '',
list: [],
loadingClass: true,
loadingText: '正在加载中',
@ -70,7 +70,7 @@
isPage: true
}, {
name: '待付款',
type: 'unpaid',
type: 0,
list: [],
loadingClass: true,
loadingText: '正在加载中',
@ -78,7 +78,7 @@
isPage: true
}, {
name: '已付款',
type: 'paid',
type: 1,
list: [],
loadingClass: true,
loadingText: '正在加载中',
@ -87,7 +87,7 @@
},
{
name: '已完成',
type: 'complete',
type: 16,
list: [],
loadingClass: true,
loadingText: '正在加载中',
@ -96,7 +96,7 @@
},
{
name: '售后',
type: 'after_sales',
type: 6,
list: [],
loadingClass: true,
loadingText: '正在加载中',
@ -107,15 +107,67 @@
current: 0, // tab
pageSize: 10,
windowHeight: 0, //
showLogin: true,
isRefresher: true
}
},
onLoad(e) {
this.windowHeight = getApp().globalData.windowHeight;
// this.verifyUserInfo()
this.getUserOrder()
},
methods: {
//
verifyUserInfo(){
let userInfo = uni.getStorageSync('userinfo') || {};
if(!userInfo.id || !userInfo.nickname || !userInfo.avatar){
if(this.showLogin){
this.showLogin = false;
this.$url('/pages/login/index?type=userinfo');
}else{
this.showLogin = true;
this.$url('/pages/index/index', {type: 'switch'});
}
}
},
goDetails(tabIndex,index) {
console.log(tabIndex,index)
let item = this.tab_list[tabIndex].list[index]
if (item.state == 1) {
this.$routerGo('/pages/order/unpay-details?order_id=' + item.id)
} else if(item.state == 4){
this.$routerGo('/pages/order/refund_detail?order_id=' + item.id)
}else {
this.$routerGo('/pages/order/order-details?order_id=' + item.id)
}
},
//
getUserOrder() {
console.log('获取数据')
getUserOrder(options = {}) {
let per_page = this.pageSize;
let tab_item = this.tab_list[this.current];
this.$http(this.API.API_ORDERLIST, {
status: this.tab_list[this.current].type,
page: tab_item.page
}).then(res => {
let isPage = res.data.has_more_page;
tab_item.isPage = isPage;
if (!isPage) {
tab_item.loadingClass = false;
tab_item.loadingText = '没有更多数据啦~';
}
if(options.type == 'pageRefresh'){
uni.stopPullDownRefresh();
}else if(options.type == 'scrollRefresh'){
this.isRefresher = false;
}
if (tab_item.page == 1) {
tab_item.list = res.data.data;
} else {
tab_item.list.push(...res.data.data);
}
console.log(tab_item.list)
})
},
// tab
@ -131,34 +183,60 @@
},
//
onScrolltolower() {
onScrolltolower(){
let tab_item = this.tab_list[this.current];
if (tab_item.isPage) {
if(tab_item.isPage){
tab_item.page = tab_item.page + 1;
this.getUserOrder();
}
},
// scroll-view
onRefresherrefresh() {
onRefresherrefresh(){
this.isRefresher = true;
this.refreshFn({
type: 'scrollRefresh'
});
this.refreshFn({type: 'scrollRefresh'});
},
//
refreshFn(options) {
refreshFn(options){
let tab_item = this.tab_list[this.current];
tab_item.page = 1;
tab_item.isPage = true;
tab_item.loadingClass = true;
tab_item.list = []
tab_item.loadingText = '正在加载中';
this.getUserOrder(options);
},
timer(value, fmt) {
if(!value) return;
let newTime = new Date(value)
if(!fmt){
fmt = 'yyyy-MM-dd hh:mm';
}
if(/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (newTime.getFullYear() + '').substr(4 - RegExp.$1.length));
}
let o = {
'M+': newTime.getMonth() + 1,
'd+': newTime.getDate(),
'h+': newTime.getHours(),
'm+': newTime.getMinutes(),
's+': newTime.getSeconds()
};
function padLeftZero(str) {
return ('00'+str).substr(str.length);
}
//
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
// console.log(`${k}`)
let str = o[k] + '';
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
}
}
return fmt;
}
},
onPullDownRefresh() {
this.refreshFn({
type: 'pageRefresh'
});
this.refreshFn({type: 'pageRefresh'});
}
}
</script>
@ -199,6 +277,7 @@
//
.com {
width: 100%;
height: 100%;
overflow: hidden;
.list {

107
pages/user/user.vue

@ -99,77 +99,31 @@
return {
loading_class: false,
loading_text: '已加载全部数据~',
list: [
{
price: 35,
title: '北国风光,千里冰封,万里雪飘',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23327_s.jpg',
},
{
price: 75,
title: '望长城内外,惟余莽莽',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23325_s.jpg',
},
{
price: 385,
title: '大河上下,顿失滔滔',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
},
{
price: 784,
title: '欲与天公试比高',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/zzpic23369_s.jpg',
},
{
price: 7891,
title: '须晴日,看红装素裹,分外妖娆',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2130_s.jpg',
},
{
price: 2341,
shop: '李白杜甫白居易旗舰店',
title: '江山如此多娇,引无数英雄竞折腰',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23346_s.jpg',
},
{
price: 661,
shop: '李白杜甫白居易旗舰店',
title: '惜秦皇汉武,略输文采',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23344_s.jpg',
},
{
price: 1654,
title: '唐宗宋祖,稍逊风骚',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg',
},
{
price: 1678,
title: '一代天骄,成吉思汗',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg',
},
{
price: 924,
title: '只识弯弓射大雕',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg',
},
{
price: 8243,
title: '俱往矣,数风流人物,还看今朝',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg',
},
]
list: [],
page: 1,
isPage: false
}
},
methods: {
getRecommond() {
this.$http(this.API.API_RECOMMOND,{page: this.page}).then(res => {
let isPage = res.data.next_page_url == null?false:true;
this.isPage = isPage;
if(!isPage){
this.loadingClass = false;
this.loadingText = '没有更多数据啦~';
}
if(this.page == 1){
this.list = res.data.data;
}else{
this.list.push(...res.data.data);
}
uni.stopPullDownRefresh();
console.log(this.list)
}).catch(err => {
})
},
//
lookImg(img){
this.$u.throttle(() => {
@ -178,18 +132,15 @@
})
}, 200);
},
addRandomData() {
for(let i = 0; i < 10; i++) {
let index = this.$u.random(0, this.list.length - 1);
//
let item = JSON.parse(JSON.stringify(this.list[index]))
item.id = this.$u.guid();
this.list.push(item);
}
},
},
onReachBottom(){
if(this.isPage){
this.page = this.page + 1;
this.getRecommond();
}
},
onLoad() {
this.addRandomData()
this.getRecommond()
}
}
</script>

Loading…
Cancel
Save