页面优化与文章接口调用

dev
shuxiaoquan 1 year ago
parent 9cf373031f
commit 2da5869dd6
  1. 14
      api/article/index.js
  2. 5
      api/goods/index.js
  3. 2
      pages.json
  4. 17
      pages/activity/newPeople.vue
  5. 5
      pages/activity/newsshop.vue
  6. 2
      pages/activity/presale.vue
  7. 5
      pages/activity/presaleRule.vue
  8. 3
      pages/activity/ranking.vue
  9. 3
      pages/activity/seckill.vue
  10. 84
      pages/index/index.vue
  11. 114
      pages/news/article/add.vue
  12. 48
      pages/news/article/classify.vue
  13. 2
      pages/news/article/detail.vue
  14. 42
      pages/news/article/index.vue
  15. 4
      pages/news/coupon/index.vue
  16. 168
      pages/news/park/browsingHistory.vue
  17. 234
      pages/serve/pay.vue
  18. 12
      pages/user/vip/goods.vue
  19. 2
      utils/request/index.js

@ -4,14 +4,18 @@ import request from '@/utils/request'
const api = {
list: 'article/list',
detail: 'article/detail',
del: 'storeKeeper/articleDelete',
edit: 'storeKeeper/articleEdit',
add: 'storeKeeper/articleAdd',
del: 'article/delete',
edit: 'article/edit',
add: 'article/add',
articleCatList: 'article.category/list',
articleCatAdd: 'storeKeeper/articleCatAdd',
articleCatDelete: 'storeKeeper/articleCatDelete',
articleCatAdd: 'article/addCategory',
articleCatDelete: 'article/articleCatDelete',
articleCatEdit: 'storeKeeper/articleCatEdit'
}
// 文章分类列表 新增
export function articleCatAdd(param, option) {
return request.post(api.articleCatAdd, param, option)
}
// 文章分类列表
export function articleCatList(param, option) {
return request.get(api.articleCatList, param, option)

@ -17,6 +17,11 @@ const api = {
export const browseHistoryList = (param, option) => {
return request.get('goods/browseLog', param, option)
}
// 商品浏览记录 删除
export const browseHistoryDel = (param, option) => {
return request.post('goods/browseDel', param, option)
}
// 取消预约
export const canlpresale = (data) => {

@ -531,7 +531,7 @@
{
"path": "article/detail",
"style": {
"navigationBarTitleText": "文章详情",
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},

@ -35,19 +35,18 @@
<view class="o">{{item.goods_price_min}}</view>
</view>
<view class="desc">
200+条评论 99%好评率
{{item.goods_sales}}+条评论 {{item.remaizhishu}}%好评率
</view>
</view>
</view>
</view>
<view class="newpeople-fd">
<view class="newpeople-fd" @click="openPage()">
<image src="@/static/news/top.png"></image>
</view>
</view>
</template>
<script>
import img from "@/static/news/newPeople-bg.png"
import * as Api from '@/api/activity'
export default {
data() {
@ -55,7 +54,7 @@
current: 1,
isLoading: true,
background: {
background: 'url(' + img + ') center top no-repeat',
background: 'url(https://www.saas.njrenzhou.com/static/news/newPeople-bg.png) center top no-repeat',
backgroundSize: '100%',
},
@ -80,6 +79,9 @@
data
} = await Api.receive({couponId:item.coupon_id});
if (status == 200) {
uni.showToast({
title: "领取成功"
})
this.getCoupons()
}
},
@ -112,6 +114,11 @@
app.current = index;
app.getListgoodData(index != 0 ? app.menuList[index].category_id : '')
},
openPage(){
uni.pageScrollTo({
scrollTop: 0
})
},
//
async getListCharts() {
let app = this
@ -143,7 +150,7 @@
<style lang="scss" scoped>
.newpeople {
background: url(@/static/news/newPeople-bg.png) center top no-repeat;
background: url(https://www.saas.njrenzhou.com/static/news/newPeople-bg.png) center top no-repeat;
background-size: 100% auto;
overflow: hidden;

@ -167,7 +167,6 @@
</template>
<script>
import img from "@/static/news/newshop-bg.png"
import * as Api from '@/api/activity'
export default {
data() {
@ -192,7 +191,7 @@
}],
background: {
background: 'url(' + img + ') center top no-repeat',
background: 'url(https://www.saas.njrenzhou.com/static/news/newshop-bg.png) center top no-repeat',
backgroundSize: '100% auto',
},
}
@ -208,7 +207,7 @@
width: 100%;
overflow: hidden;
min-height: 100vh;
background: url(@/static/news/newshop-bg.png) center top no-repeat;
background: url(https://www.saas.njrenzhou.com/static/news/newshop-bg.png) center top no-repeat;
background-size: 100% auto;
&-hd {

@ -126,7 +126,7 @@
<style lang="scss" scoped>
.presale {
background: #ff7b79 url(@/static/news/newPresale-bg.jpg) center top no-repeat;
background: #ff7b79 url(https://www.saas.njrenzhou.com/static/news/newPresale-bg.jpg) center top no-repeat;
background-size: 100% auto;
overflow: hidden;
min-height: 100vh;

@ -5,15 +5,10 @@
</template>
<script>
import img from "@/static/rank/top.png"
import * as Api from '@/api/activity'
export default {
data() {
return {
background: {
background: 'url(' + img + ') center top no-repeat',
backgroundSize: '100% auto',
},
content: '',
type: 4
}

@ -79,13 +79,12 @@
</template>
<script>
import img from "@/static/rank/rank1.png"
import * as Api from '@/api/activity'
export default {
data() {
return {
background: {
background: 'url(' + img + ') center top no-repeat',
background: 'url(https://www.saas.njrenzhou.com/static/rank/rank1.png) center top no-repeat',
backgroundSize: '100% auto',
},
chosed: 0,

@ -76,7 +76,6 @@
</template>
<script>
import img from "@/static/rank/rank1.png"
import WxofficialMixin from '@/core/mixins/wxofficial'
import CountDown from '@/components/countdown'
import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins'
@ -123,7 +122,7 @@
//
goodsList: [],
background: {
background: 'url('+ img+') center top no-repeat',
background: 'url(https://www.saas.njrenzhou.com/static/rank/rank1.png) center top no-repeat',
backgroundSize: '100% auto',
},
backgroundImg:''

@ -20,7 +20,7 @@
<view class="group_4">
<view class="group_5" @click="search">
<view class="image-text_6">
<image src="../../static/home/search.png" mode="" class="box_4"></image>
<image src="https://www.saas.njrenzhou.com/static/home/search.png" mode="" class="box_4"></image>
<text lines="1" decode="true" class="text-group_6">iPhone&nbsp;15</text>
</view>
<view class="text-wrapper_2">
@ -65,19 +65,19 @@
<image src="/static/home/ys.png" class="label_2-0"></image>
<text lines="1" class="text-group_8-0">预售专区</text>
</view>
<view class="image-text_8-0" @click="goPage('/pages/invite/index')">
<view class="image-text_8-0" @click="goPage('/pages/invite/index',1)">
<image src="/static/home/yq.png" class="label_2-0"></image>
<text lines="1" class="text-group_8-0">邀请有礼</text>
</view>
<view class="image-text_8-0" @click="goPage('/pages/coupon/index')">
<view class="image-text_8-0" @click="goPage('/pages/news/coupon/index',1)">
<image src="/static/home/lq.png" class="label_2-0"></image>
<text lines="1" class="text-group_8-0">领券中心</text>
</view>
<view class="image-text_8-0" @click="goPage()">
<view class="image-text_8-0" @click="goPage('/pages/serve/index',3)">
<image src="/static/home/az.png" class="label_2-0"></image>
<text lines="1" class="text-group_8-0">安装报修</text>
</view>
<view class="image-text_8-0" @click="goPage('/pages/news/recycling/index')">
<view class="image-text_8-0" @click="goPage('/pages/news/recycling/index',1)">
<image src="/static/home/sm.png" class="label_2-0"></image>
<text lines="1" class="text-group_8-0">上门回收</text>
</view>
@ -186,7 +186,7 @@
</view>
<view class="newGoods">
<view class="newImage" @click="goNews">
<image src="../../static/home/newImg.png" mode=""></image>
<image src="https://www.saas.njrenzhou.com/static/home/newImg.png" mode=""></image>
</view>
<view class="newRight">
<view class="newFirt" @click="goNewGoods">
@ -402,7 +402,6 @@
</view>
</template>
<script>
import img from "@/static/home/top.png"
import * as GoodsApi from '@/api/home/index.js';
import * as limit from '@/api/sharp/home.js';
import CountDown from '@/components/countdown';
@ -414,7 +413,7 @@
data() {
return {
background: {
background: 'url(' + img + ') center top no-repeat',
background: 'url(https://www.saas.njrenzhou.com/static/home/top.png) center top no-repeat',
backgroundSize: '100% auto',
},
suggestGoodsList: [],
@ -478,13 +477,19 @@
that.seckillList = []
limit.data()
.then(result => {
let seckillList = result.data.goodsList.data;
that.seckillCutDownTime = result.data.tabbar[0].count_down_time
for (var i = 0; i < seckillList.length; i++) {
if (seckillList[i].spec_type == 10) {
that.seckillList.push(seckillList[i])
let seckillList = [];
if(result.data.tabbar && result.data.tabbar.length > 0){
that.seckillCutDownTime = result.data.tabbar[0].count_down_time;
}
if(result.data.goodsList && result.data.goodsList.data.length > 0){
seckillList = result.data.goodsList.data;
for (var i = 0; i < seckillList.length; i++) {
if (seckillList[i].spec_type == 10) {
that.seckillList.push(seckillList[i])
}
}
}
})
},
@ -504,7 +509,13 @@
}
GoodsApi.brandList(param)
.then(res => {
that.bigGoodsList = res.data.data;
let arr = res.data.data;
if(arr && arr.length > 0){
arr.map(a=>{
a.goods_price_min = Number(a.goods_price_min)
})
}
that.bigGoodsList = arr;
})
.finally(() => {})
@ -539,7 +550,8 @@
changeGoodsType(item) {
//
this.chosedType = item.category_id
this.secondType =item.children
this.secondType =item.children;
console.log(this.secondType)
},
changeHome(val) {
this.type = val
@ -583,9 +595,22 @@
url: '/pages/activity/ranking'
})
},
goPage(url) {
goPage(url,type) {
if(type == 1){
if(!uni.getStorageSync("AccessToken")){
uni.navigateTo({
url: "/pages/login/index"
})
return ;
}
}else{
uni.switchTab({
url
})
return ;
}
uni.navigateTo({
url:url
url
})
},
goBigGoods() {
@ -952,7 +977,7 @@
}
.group_6 {
background-image: url('../../static/home/news.png');
background-image: url('https://www.saas.njrenzhou.com/static/home/news.png');
background-size: 100% 100%;
height: 44rpx;
margin-top: 10rpx;
@ -991,7 +1016,7 @@
height: 44rpx;
flex-direction: row;
display: flex;
margin: 14rpx 0 0 40rpx;
margin: 30rpx 0 0 40rpx;
}
.text_5 {
@ -1039,7 +1064,7 @@
.newUser {
width: 698rpx;
height: 230rpx;
background-image: url('../../static/home/newUserBg.png');
background-image: url('https://www.saas.njrenzhou.com/static/home/newUserBg.png');
background-size: 100% 100%;
margin-left: 20rpx;
@ -1135,7 +1160,7 @@
.big {
width: 696rpx;
max-height: 408rpx;
background-image: url('../../static/home/bigBack.png');
background-image: url('https://www.saas.njrenzhou.com/static/home/bigBack.png');
background-size: 100% 100%;
margin-top: 16rpx;
margin-left: 20rpx;
@ -1169,7 +1194,7 @@
font-weight: 500;
color: #8C4D00;
line-height: 42rpx;
background-image: url('../../static/home/shopBack.png');
background-image: url('https://www.saas.njrenzhou.com/static/home/shopBack.png');
margin-left: 12rpx;
.shopText {
@ -1215,7 +1240,7 @@
height: 34rpx;
position: relative;
top: -6rpx;
background-image: url('../../static/home/priceBack.png');
background-image: url('https://www.saas.njrenzhou.com/static/home/priceBack.png');
background-size: 100% 100;
text-align: center;
@ -1226,6 +1251,11 @@
font-weight: 400;
color: #FFFFFF;
line-height: 28rpx;
display: block;
width: 90rpx;
margin: 0 auto;
text-align: center;
margin-top: 5rpx;
}
}
@ -1353,7 +1383,7 @@
color: #FFFFFF;
line-height: 32rpx;
text-align: center;
background-image: url('../../static/home/tip.png');
background-image: url('https://www.saas.njrenzhou.com/static/home/tip.png');
}
.oldPrice {
@ -1404,7 +1434,7 @@
.newFirt {
width: 390rpx;
height: 208rpx;
background-image: url('../../static/home/newFirst.png');
background-image: url('https://www.saas.njrenzhou.com/static/home/newFirst.png');
background-size: 100% 100%;
.starting {
@ -1448,7 +1478,7 @@
width: 112rpx;
height: 34rpx;
position: absolute;
background-image: url('../../static/home/priceBack.png');
background-image: url('https://www.saas.njrenzhou.com/static/home/priceBack.png');
background-size: 100% 100%;
top: 100rpx;
font-size: 20rpx;
@ -1466,7 +1496,7 @@
margin-top: 16rpx;
width: 390rpx;
height: 208rpx;
// background-image: url('../../static/home/ranking.png');
// background-image: url('https://www.saas.njrenzhou.com/static/home/ranking.png');
background-size: 100% 100%;
}
}

@ -30,7 +30,7 @@
<view class="a">文章内容<text>*</text></view>
<view class="b">
<editor id="editor" class="ql-container" placeholder="开始输入..." show-img-size show-img-toolbar
show-img-resize @statuschange="onStatusChange" :read-only="readOnly" @ready="onEditorReady">
show-img-resize @statuschange="onStatusChange" @input="inputEditor" :read-only="readOnly" @ready="onEditorReady">
</editor>
</view>
</view>
@ -40,10 +40,11 @@
</view>
<u-popup v-model="isShow" mode="bottom" border-radius="12" mask-close-able="false" closeable>
<view class="goods-classify">
<view class="goods-classify-hd">商品分类</view>
<view class="goods-classify-hd">
<view class="a" @click="openPage(4)"><u-icon name="plus"></u-icon></view></view>
<view class="goods-classify-bd">
<scroll-view scroll-y class="m">
<view class="item" v-for="(a,i) in list" @click="tabMItem(i)"><view :class="tabMIndex == i?'item-on':''">{{a.name}}</view></view>
<view class="item" v-for="(a,i) in list" @click="tabMItem(i,a.category_id)"><view :class="tabMIndex == i?'item-on':''">{{a.name}}</view></view>
</scroll-view>
</view>
</view>
@ -68,44 +69,82 @@
popupType: 1,
tabMIndex: -1,
type: -1,
id: ''
articleId: '',
clickFlag: true,
};
},
onLoad(o) {
this.getCategoryList();
this.id = o.article_id;
console.log(o)
this.articleId = o.articleId;
this.type = o.type;
uni.setNavigationBarTitle({
title: !this.id?'新增文章':'编辑文章'
title: !this.articleId?'新增文章':'编辑文章'
})
if(this.id){
if(this.articleId){
this.getArticleDetail();
}else {
this.getCategoryList();
}
},
onReady() {
this.action = (Config.get('apiUrl')+'user/image').replace("index.php?s=/","")
this.action = (Config.get('apiUrl')+'upload/image').replace("index.php?s=/","")
this.header = {
'Storeid': uni.getStorageSync('Store').storeInfo.store_id,
'AccessToken': uni.getStorageSync('AccessToken'),
'Access-Token': uni.getStorageSync('AccessToken'),
'platform': "MP-WEIXIN",
}
uni.$on("reloadClasssify",this.getCategoryList())
},
methods: {
success(a,b) {
console.log(a)
console.log(b)
//
success(list) {
if(list.length > 0){
const {response} = list[0];
if(response.status == 200){
uni.showToast({
title: "上传成功"
})
this.detail.image_id = response.data.fileInfo.file_id
}
}
},
//
async getArticleDetail() {
const that = this;
const {status, message, data} = await ArticleApi.detail(this.articleId);
if(status == 200){
this.detail = data.detail
if( data.detail.image_url){
this.fileList = [{
url: data.detail.image_url
}]
}
setTimeout(()=>{
if(that.editorCtx){
that.editorCtx.setContents({
html: data.detail.content
})
}
},500)
this.getCategoryList(1);
}
},
//
async getCategoryList(categoryId) {
async getCategoryList(type) {
const that = this;
const {status, message, data} = await CategoryApi.list();
if(status == 200){
if(type == 1){
if(data.list && data.list.length > 0){
data.list.map((a,i)=>{
if(a.category_id == that.detail.category_id){
that.tabMIndex = i
}
})
}
}
this.list = data.list;
}
},
@ -139,6 +178,46 @@
})
return ;
}
if(this.clickFlag == false){
return ;
}
this.clickFlag = false
const { status, message } = this.articleId? await ArticleApi.edit({
article_id: this.articleId,
title: this.detail.title,
category_id: this.detail.category_id,
image_id: this.detail.image_id,
content: this.detail.content,
sort: 2,
status: 1
}):await ArticleApi.add({
title: this.detail.title,
category_id: this.detail.category_id,
image_id: this.detail.image_id,
content: this.detail.content,
sort: 2,
status: 1
});
if(status == 200){
this.clickFlag = true
uni.showToast({
title: "提交成功"
})
setTimeout(()=>{
uni.navigateBack({
delta: 1
})
},2000)
}else{
this.clickFlag = true
uni.showToast({
icon: "none",
title: message
})
}
},
inputEditor(e) {
this.detail.content = e.detail.html
},
onStatusChange(e) {
const formats = e.detail
@ -148,18 +227,21 @@
uni.createSelectorQuery().select('#editor').context((res) => {
this.editorCtx = res.context
}).exec()
},
openPage(i){
if(i == 1){
this.isShow = true;
}else if(i == 4){
this.isShow = false;
uni.navigateTo({
url: "/pages/news/goods/classification"
url: "/pages/news/article/classify"
})
}
},
tabMItem(index) {
tabMItem(index,category_id) {
this.tabMIndex = index;
this.detail.category_id = category_id
this.isShow = false;
},
}

@ -4,8 +4,7 @@
<view class="item">
<view class="a">分类名称</view>
<view class="b">
<input :value="name" type="text" placeholder="请输入分类名称"><u-icon name="arrow-right"></u-icon>
<!-- <view @click="openPage(1)" class="select" :class="tabMIndex>= 0?'select-on':''">{{tabMIndex>=0? list[tabMIndex].name:'请输入分类名称'}}<u-icon name="arrow-right"></u-icon></view> -->
<input v-model="name" type="text" placeholder="请输入分类名称">
</view>
</view>
<view class="items">
@ -15,7 +14,7 @@
</view>
</view>
<view class="items">
<view class="a">排序<text>*</text><view class="input"><input :value="sort" type="text" placeholder="数字越小越靠前"/></view></view>
<view class="a">排序<text>*</text><view class="input"><input v-model="sort" type="text" placeholder="数字越小越靠前"/></view></view>
<view class="d">1</view>
</view>
</view>
@ -27,7 +26,7 @@
</template>
<script>
import * as CategoryApi from '@/api/article/category'
import * as ArticleApi from '@/api/article'
export default {
data() {
return {
@ -36,12 +35,48 @@
name: "",
tabMIndex: -1,
list: [],
checked: true
checked: true,
clickFlag: true,
};
},
methods: {
//
async toSubmit(){
async toSubmit(){
if(!this.name){
uni.showToast({
icon: "none",
title: "分类名称不能为空!"
})
return ;
}
if(this.clickFlag == false){
return ;
}
this.clickFlag = false
const { status, message } = await ArticleApi.articleCatAdd({
name: this.name,
img_id: this.img_id,
status: this.checked ?1:0,
sort: this.sort,
});
if(status == 200){
this.clickFlag = true
uni.showToast({
title: "提交成功"
})
uni.$emit("reloadClasssify")
setTimeout(()=>{
uni.navigateBack({
delta: 1
})
},2000)
}else{
this.clickFlag = true
uni.showToast({
icon: "none",
title: message
})
}
},
}
@ -194,6 +229,7 @@
font-size: 28rpx;
font-weight: 500;
color: #FFFFFF;
margin: 0 auto;
}
}
&-classify{

@ -1,7 +1,7 @@
<template>
<view class="article">
<view class="title">{{detail.title}}</view>
<view class="desc">{{detail.createTime}}</view>
<view class="desc">{{detail.create_time}}</view>
<view class="content" v-html="detail.content"></view>
</view>
</template>

@ -13,7 +13,7 @@
<u-tabs :list="list" :is-scroll="false" v-model="current" @change="changeTab" active-color="#FF2525" inactive-color="#6F6F6F" font-size="30" ></u-tabs>
</view>
<view class="article-bd">
<u-swipe-action class="b" v-for="(a,i) in articleList" :index="i" @open="open" :key="i" @click="clickItem" :options="options">
<u-swipe-action class="b" v-for="(a,i) in articleList" :index="i" :key="i" @click="clickItem" :options="options">
<view class="item u-border-bottom">
<view class="pic" @click.stop="toDetail(1,a)">
<image mode="aspectFill" :src="a.image_url" />
@ -58,7 +58,7 @@
current: 0
};
},
onReady() {
onShow() {
this.getCategoryList();
},
onReachBottom() {
@ -87,9 +87,7 @@
title:"加载中"
})
this.current = i
this.pageNum = 1;
this.articleList = []
this.getArticleList();
this.getArticleList(1);
},
async toDel(index,article_id){
const {status, message, data} = await ArticleApi.del({
@ -99,7 +97,7 @@
uni.showToast({
title: "删除成功"
})
this.articleList.splice(index, 1);
this.getArticleList(1);
}
},
//
@ -107,7 +105,7 @@
const {status, message, data} = await ArticleApi.articleCatList();
if(status == 200){
this.list = data.list;
this.getArticleList();
this.getArticleList(1);
}
},
/**
@ -132,38 +130,28 @@
}
this.articleList = this.articleList.concat(data.list.data)
this.total = data.list.total
console.log(this.articleList)
}
},
clickItem(index, index1){
console.log(index)
if(index1 == 0){
uni.navigateTo({
url: "/pages/news/article/add?type=2&articleId="+this.articleList[index].article_id
})
}else{
const that = this;
uni.showModal({
title: "温馨提示",
content: "确定要删除该信息?",
confirmColor: "#FF584D",
complete(res) {
if(res.confirm){
this.toDel(index,this.articleList[index].category_id);
that.toDel(index,that.articleList[index].article_id);
}
// if(res.CategoryApi)
}
})
}
},
//
open(index) {
// swipeActionprops
// 'false''false'
this.list[index].show = true;
this.list.map((val, idx) => {
if(index != idx) this.list[idx].show = false;
})
}
}
}
</script>
@ -255,12 +243,16 @@
color: #3B3B3B;
}
.desc{
font-size: 26rpx;
color: #999;
height: 100rpx;
line-height: 50rpx;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
}
}

@ -1,7 +1,7 @@
<template>
<view class="coupon">
<view class="coupon-hd">
<image src="@/static/news/coupon-bg.jpg"></image>
<image src="https://www.saas.njrenzhou.com/static/news/coupon-bg.jpg"></image>
</view>
<view class="coupon-tab">
<view class="item" :class="tabIndex == 0?'item-on':''" @click="tabItem(0)">商品券</view>
@ -228,11 +228,11 @@
justify-content: center;
align-items: center;
font-size: 36rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #FA3B22;
line-height: 148rpx;
background: linear-gradient(180deg, #FFFFFF 0%, #FEEECA 100%);
z-index: 999;
.fooIcon{
margin-left: 36rpx;
}

@ -1,43 +1,44 @@
<template>
<view class="browsing">
<view class="browsing-hd">
<view class="do">{{isToggle?'操作':'编辑'}}</view>
<view class="do" @click="openPage(1)">{{isToggle?'操作':'编辑'}}</view>
</view>
<view class="browsing-bd">
<view class="li" v-for="i in 2" :key="i">
<view class="a">今天</view>
<u-swipe-action class="b" v-for="k in 5" :key="i" @click="clickItem(i)" :options="options">
<view class="li" v-for="(a, i) in list" :key="i">
<view class="a">{{a.week == '今天'?a.week: a.name}}</view>
<u-swipe-action class="b" v-for="(b,k) in a.list" :key="k" @click="clickItem(i,b.goods_id)" :options="options">
<view class="item u-border-bottom">
<view class="select" v-if="isToggle">
<image mode="aspectFill" v-if="true" src="@/static/invoice/select.png" />
<image mode="aspectFill" v-else src="@/static/invoice/select-on.png" />
<view class="select" v-if="isToggle" @click.stop="openPage(4,i,k)">
<image mode="aspectFill" v-if="b.isSelect" src="@/static/invoice/select-on.png" />
<image mode="aspectFill" v-else src="@/static/invoice/select.png" />
</view>
<view class="pic">
<image mode="aspectFill" src="@/static/home/phone.jpg" />
<view class="pic" @click.stop="openPage(5,b.goods_id)">
<image mode="aspectFill" v-if="b.imgs" :src="b.imgs" />
</view>
<!-- 此层wrap在此为必写的否则可能会出现标题定位错误 -->
<view class="info title-wrap">
<view class="title">荣耀畅玩 40 Plus 全网通5G版 绿8GB+128GB</view>
<view class="sku">
<view class="box">绿 8GB+128GB选服务</view><u-icon style="margin-left: 10rpx;" name="arrow-down"></u-icon>
<view class="info title-wrap" @click.stop="openPage(5,b.goods_id)">
<view class="title">{{b.goods.goods_name}}</view>
<view class="sku" v-if="b.skustr">
<view class="box">{{b.skustr}}</view><u-icon style="margin-left: 10rpx;" name="arrow-down"></u-icon>
</view>
<view class="sku" v-else></view>
<view class="fd">
<view class="price"><text>1120</text></view>
<view class="price"><text>{{b.goods.goods_price_min}}</text></view>
<image class="icon" src="@/static/news/icon-recycling-08.png"></image>
</view>
</view>
</view>
</u-swipe-action>
</view>
<u-empty text="暂无信息" v-if="total == 0" mode="list"></u-empty>
<u-empty text="暂无信息" v-if="isShow" mode="list"></u-empty>
</view>
<view class="browsing-fd">
<view class="a">
<image mode="aspectFill" v-if="true" src="@/static/invoice/select.png" />
<image mode="aspectFill" v-else src="@/static/invoice/select-on.png" />全选
<view class="browsing-fd" v-if="isToggle">
<view class="a" @click="openPage(3)">
<image mode="aspectFill" v-if="isSelect" src="@/static/invoice/select-on.png" />
<image mode="aspectFill" v-else src="@/static/invoice/select.png" />全选
</view>
<view class="b"><text>0</text>件商品</view>
<view class="c">删除</view>
<view class="b"><text>{{goodsids.length}}</text>件商品</view>
<view class="c" @click="openPage(2)">删除</view>
</view>
</view>
</template>
@ -48,9 +49,11 @@
data() {
return {
isToggle: false,
isSelect: false,
list: [],
total: 1,
isShow: false,
pageNum: 1,
goodsids: [],
options: [
{
text: '删除',
@ -61,34 +64,124 @@
],
};
},
onReady() {
onShow() {
this.getBrowseHistoryList();
},
onReachBottom() {
if(this.list.length <= this.total){
uni.showLoading({
title:"加载中"
})
this.pageNum ++;
this.getBrowseHistoryList();
}
},
methods: {
openPage(index,i,k){
const that = this;
if(index == 1){
this.isToggle = !this.isToggle
}else if(index == 2){
uni.showModal({
title: "温馨提示",
content: "确定要全部删除吗?",
confirmColor: "#FF564A",
complete(res) {
that.toDel()
}
})
}else if(index == 3){
if(this.list && this.list.length >0){
this.list.map(a=>{
if(a.list && a.list.length > 0){
a.list.map(b=>{
if(that.isSelect == false){
b.isSelect = true
}else {
b.isSelect = false
}
})
}
})
}
that.isSelect = !that.isSelect
this.totallGoods();
}else if(index == 4){
this.list[i].list[k].isSelect = !this.list[i].list[k].isSelect
this.totallGoods();
}else if(index == 5){
uni.navigateTo({
url: "/pages/goods/detail?goodsId="+i
})
}
},
//
totallGoods() {
let arr = []
if(this.list && this.list.length >0){
this.list.map(a=>{
if(a.list && a.list.length > 0){
a.list.map(b=>{
if(b.isSelect){
arr.push(b.id)
}
})
}
})
}
this.goodsids = Array.from(new Set(arr));
},
//
async toDel() {
const that = this;
const {status, data} = await GoodsApi.browseHistoryDel({
ids: this.goodsids
})
if(status == 200){
uni.showToast({
title: "删除成功"
})
setTimeout(()=>{
that.getBrowseHistoryList();
},1000)
}
},
/**
* 获取浏览记录列表
*/
async getBrowseHistoryList() {
const {status, data} = await GoodsApi.browseHistoryList({
let {status, data} = await GoodsApi.browseHistoryList({
page: this.pageNum
})
if(status == 200){
uni.hideLoading();
this.list = this.list.concat(data.list.data)
this.total = data.list.total
if(data && data.length > 0){
data.map(a=>{
if(a.list && a.list.length > 0){
a.list.map(b=>{
b.isSelect = false;
b.imgs = ""
if(b.images && b.images.length > 0){
b.imgs = b.images[0].file.external_url
}
b.skustr = ""
if(b.sku){
if(b.sku.goods_props && b.sku.goods_props.length>0){
b.sku.goods_props.map(c=>{
b.skustr+= c.value.name
})
}
}
})
}
})
}
this.list = data;
this.isShow = data && data.length > 0?false:true
}
},
clickItem(idx,index){
console.log(idx,index)
clickItem(idx,id){
const that = this;
uni.showModal({
title: "温馨提示",
content: "确定要删除吗?",
confirmColor: "#FF564A",
complete(res) {
that.goodsids = id;
that.toDel()
}
})
}
}
}
@ -196,6 +289,7 @@
font-weight: 400;
color: #000000;
height: 80rpx;
overflow: hidden;
}
.sku{
width: 320rpx;

@ -0,0 +1,234 @@
<template>
<view class="pay">
<view class="pay-hd">
<view class="a">订单号<text>{{order_id}}</text></view>
<view class="a">支付价格<text>{{orderInfo.pay_price}}</text></view>
</view>
<view class="pay-bd">
<view class="title">选择支付方式</view>
<view class="item" v-for="(a,i) in list2" @click="tabItem(i)">
<image v-if="tabIndex == i" src="@/static/invoice/select-on.png"></image>
<image v-else src="@/static/invoice/select.png"></image>
{{a.method == 'wechat'?'微信支付':'余额支付'}}<text v-if="a.method == 'balance'">余额{{userInfo.balance}}</text>
</view>
</view>
<view class="pay-btn" @click="clickPay()">确认支付</view>
</view>
</template>
<script>
import { Wechat } from '@/core/payment'
import * as newFunApi from '@/api/newFun'
export default {
data() {
return {
tabIndex: 0,
type: "",
order_id: "",
userInfo: {},
list2: [],
orderInfo: {},
isClick: true,
};
},
onLoad(o) {
console.log(o)
this.order_id = o.order_id;
this.type = o.type;
this.toServerOrder();
},
methods: {
clickPay(){
if(this.isClick == false){
return;
}
this.isClick = false;
if(this.list2[this.tabIndex].method == "balance"){
if(Number(this.orderInfo.pay_price) <= Number(this.userInfo.balance)){
this.toPay()
}else{
this.isClick = true;
uni.showToast({
icon: "none",
title: "余额不足,请选择其他支付方式"
})
}
}else if(this.list2[this.tabIndex].method == "wechat"){
this.toPay1()
}
},
//
async toServerOrder(order_id) {
let {status, data, message } = await newFunApi.serverOrderInfo({
client: 'MP-WEIXIN',
order_id: this.order_id
})
if(status == 200){
this.userInfo = data.personal
this.orderInfo = data.order
this.list2 = data.paymentMethods;
console.log(data)
console.log(this.orderInfo)
console.log(this.list2)
console.log(this.userInfo)
}else{
uni.showToast({
icon: "none",
title: message
})
}
},
async toPay1() {
const that = this;
const {status, data } = await newFunApi.serverOrderPay({
order_id: this.order_id,
method: 'wechat',
client: "MP-WEIXIN",
})
if(status == 200) {
Wechat.payment(data.payment)
.then((result) => {
console.log(22,result)
uni.showToast({
title: "支付成功"
})
this.isClick = true;
setTimeout(()=>{
if(that.type == 'fuwu'){
uni.redirectTo({
url: "/pages/news/recycling/orderList"
})
}else if(that.type == 'fuwuorder'){
uni.navigateBack({
delta:1
})
}
},1000)
})
.catch(err => {
uni.showToast({
title: "支付失败"
})
this.isClick = true;
setTimeout(()=>{
if(that.type == 'fuwu'){
uni.redirectTo({
url: "/pages/news/recycling/orderList"
})
}else if(that.type == 'fuwuorder'){
uni.navigateBack({
delta:1
})
}
},1000)
})
}
},
//
async toPay() {
const that = this;
const {status, message} = await newFunApi.serverOrderPay({
order_id: this.order_id,
method: 'balance',
client: "MP-WEIXIN",
})
if(status == 200) {
uni.showToast({
title: "支付成功"
})
this.isClick = true;
setTimeout(()=>{
if(that.type == 'fuwu'){
uni.redirectTo({
url: "/pages/news/recycling/orderList"
})
}else if(that.type == 'fuwuorder'){
uni.navigateBack({
delta:1
})
}
},1000)
}else{
this.isClick = true;
uni.showToast({
icon: "none",
title: message
})
}
},
tabItem(i){
this.tabIndex = i
}
}
}
</script>
<style lang="scss" scoped>
.pay{
overflow: hidden;
&-hd{
width: 710rpx;
padding: 0 20rpx;
box-sizing: border-box;
background-color: #fff;
margin: 0 auto;
margin-top: 20rpx;
.a{
padding: 20rpx 0;
display: flex;
align-items: center;
font-size: 28rpx;
color: #666;
text{
margin-left: 20rpx;
color: #212121;
}
}
}
&-bd{
width: 710rpx;
padding: 0 20rpx;
box-sizing: border-box;
background-color: #fff;
margin: 0 auto;
margin-top: 20rpx;
.title{
padding: 30rpx 0;
font-size: 30rpx;
}
.item{
padding: 20rpx 0;
display: flex;
align-items: center;
font-size: 28rpx;
color: #212121;
image{
width: 30rpx;
height: 30rpx;
margin-right: 20rpx;
}
text{
margin-left: 20rpx;
color: #666;
}
}
}
&-btn{
width: 710rpx;
padding: 0 20rpx;
line-height: 80rpx;
box-sizing: border-box;
background-color: #ff3939;
margin: 0 auto;
margin-top: 160rpx;
text-align: center;
font-size: 36rpx;
color: #fff;
border-radius: 20rpx;
}
}
</style>

@ -2,7 +2,7 @@
<view class="goods">
<u-navbar>
<view class="slot-wrap">
<u-search placeholder="iPhone 15" :show-action="false" v-model="keyword"></u-search>
<u-search @click="openPage()" placeholder="iPhone 15" disabled :show-action="false" v-model="keyword"></u-search>
</view>
</u-navbar>
<view class="goods-hd">
@ -149,7 +149,12 @@
},
goodsDetail(orderId) {
uni.navigateTo({
url: '/pages/goods/detail?orderId=' + orderId
url: '/pages/goods/detail?goodsId=' + orderId
})
},
openPage() {
uni.navigateTo({
url: "/pages/search/index"
})
},
}
@ -166,7 +171,6 @@
&-hd {
width: 100%;
height: 400rpx;
image {
width: 100%;
height: 100%;
@ -213,7 +217,7 @@
&-bd {
padding: 30rpx 0 0;
display: flex;
height: calc(100vh - 700rpx);
height: calc(100vh - 750rpx);
box-sizing: border-box;
overflow: hidden;

@ -130,7 +130,7 @@ $http.dataFactory = async res => {
// 返回正确的结果(then接受数据)
return Promise.resolve(httpData)
}
// 判断是否需要登录
if (httpData.status == 401) {
// 401也有可能是后端登录态到期, 所以要清空本地的登录状态

Loading…
Cancel
Save