提交 fc74acc2 编写于 作者: G gongfuxiang

分销新增推荐宝

上级 ad8d81d6
......@@ -1670,6 +1670,11 @@
return true;
}
return false;
},
// 价格符号
currency_symbol() {
return this.get_config('currency_symbol') || this.data.currency_symbol;
}
},
......
<template>
<view>
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event">
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event" :propIndex="propIndex">
<view class="goods-spec-choice-container padding-main bg-white pr">
<view class="close fr oh">
<view class="fr" @tap.stop="popup_close_event">
......@@ -101,6 +101,12 @@
components: {
componentPopup
},
props: {
propIndex: {
type: Number,
default: 100
}
},
created: function() {},
......
<template>
<view>
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event">
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event" :propIndex="propIndex">
<view class="goods-spec-choice-container padding-main bg-white pr">
<view class="close fr oh">
<view class="fr" @tap.stop="popup_close_event">
......@@ -46,6 +46,12 @@
components: {
componentPopup
},
props: {
propIndex: {
type: Number,
default: 100
}
},
created: function() {},
......
<template>
<view>
<view :class="'popup ' + (propClassname || '') + ' ' + ((propShow || false) ? 'popup-show' : '') + ' ' + ((propAnimation || true) ? 'animation': '' )" :disable-scroll="propDisablescroll">
<view class="popup-mask" v-if="propMask || true" @tap="on_mask_tap"></view>
<view class="popup-mask" :style="'z-index: '+propIndex+';'" v-if="propMask || true" @tap="on_mask_tap"></view>
<view :class="'popup-content bottom-line-exclude popup-' + (propPosition || 'bottom')+ ' '+(propIsBar ? 'popup-bar' : '')" :style="'left:'+popup_content_left_value+'px'">
<slot></slot>
</view>
......@@ -44,6 +44,10 @@
propIsBar: {
type: Boolean,
default: false
},
propIndex: {
type: Number,
default: 100
}
},
// 属性值改变监听
......
......@@ -456,6 +456,27 @@
"navigationBarTitleText": "推广返利"
}
},
{
"path": "recommend-list/recommend-list",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": "我的推荐宝"
}
},
{
"path": "recommend-detail/recommend-detail",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": "推荐宝详情"
}
},
{
"path": "recommend-form/recommend-form",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": "推荐宝添加/编辑"
}
},
{
"path": "team/team",
"style": {
......
/**
* 基础
*/
.base-container {
height: 280rpx;
background-size: cover;
*/
.base-container .icon {
width: 50rpx;
height: 50rpx;
}
.base-container .text {
top: 0;
left: 0;
background: rgb(0 0 0 / 35%);
padding: 100rpx 20rpx 20rpx 20rpx;
.base-container .title {
width: calc(100% - 240rpx);
}
.base-container .share-submit {
line-height: 50rpx;
height: 50rpx;
}
/**
......@@ -34,8 +35,7 @@
* 导航
*/
.nav-button {
background: #eee;
box-shadow: 0 -2px 3px #e2e2e2;
box-shadow: 0 -2px 6px #e2e2e2;
}
.nav-button .left-price {
width: calc(100% - 270rpx);
......
......@@ -2,9 +2,14 @@
<view>
<view v-if="(data || null) != null" class="page-bottom-fixed">
<view class="padding-horizontal-main padding-top-main">
<!-- 基础信息 -->
<view class="base-container tc pr padding-main border-radius-main bg-main oh spacing-mb" :style="'background-color:'+data.color+' !important;background-image:url('+data.images+')'">
<view class="text cr-white pa bs-bb text-size wh-auto ht-auto">{{data.describe}}</view>
<!-- 基础信息 -->
<view class="base-container oh spacing-mb">
<image v-if="(data.images || null) != null" class="dis-inline-block border-radius-main br va-m margin-right-sm icon" :src="data.images" mode="aspectFit"></image>
<view class="text-size cr-base fw dis-inline-block va-m title">{{data.title}}</view>
<button class="round bg-white br-green cr-green fr share-submit" type="default" size="mini" hover-class="none" @tap="share_event" :data-index="index">
<uni-icons type="redo" size="34rpx" color="#1AAD19" class="va-m"></uni-icons>
<text class="va-m">分享</text>
</button>
</view>
<view v-if="(data.goods || null) != null && data.goods.length > 0">
......@@ -14,7 +19,7 @@
<image class="goods-img dis-block border-radius-main fl" :src="item.images" mode="aspectFit" :data-value="item.goods_url" @tap="url_event"></image>
<view class="right-base fr">
<label v-if="data.type == 1 && item.is_error == 0" class="fr" :data-index="index" @tap="goods_choice_event">
<radio :checked="(item.checked == undefined || item.checked == true)" style="transform:scale(0.7)" />
<radio :checked="(item.checked == undefined || item.checked == true)" style="transform:scale(0.9)" />
</label>
<view :class="'multi-text '+(data.type == 1 ? 'padding-right' : '')">{{item.title}}</view>
<view class="single-text margin-top-sm">
......@@ -39,7 +44,7 @@
</view>
<!-- 导航 -->
<view class="nav-button bottom-fixed padding-main pr">
<view class="nav-button bottom-fixed padding-main pr bg-white">
<view class="bottom-line-exclude oh">
<view class="left-price fl">
<view v-if="data.estimate_discount_price != 0" class="pa single-text estimate-discount-price">
......@@ -61,7 +66,10 @@
</view>
<!-- 结尾 -->
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
<!-- 分享弹窗 -->
<component-share-popup ref="share"></component-share-popup>
</view>
<view v-else>
<!-- 提示信息 -->
......@@ -82,7 +90,8 @@
import componentBottomLine from "../../../../components/bottom-line/bottom-line";
import componentGoodsSpecChoice from "../../../../components/goods-spec-choice/goods-spec-choice";
import componentGoodsBuy from "../../../../components/goods-buy/goods-buy";
import componentBadge from "../../../../components/badge/badge";
import componentBadge from "../../../../components/badge/badge";
import componentSharePopup from "../../../../components/share-popup/share-popup";
export default {
data() {
......@@ -90,7 +99,7 @@
data_bottom_line_status: false,
data_list_loding_status: 1,
data_list_loding_msg: '',
currency_symbol: app.globalData.data.currency_symbol,
currency_symbol: app.globalData.data.currency_symbol(),
params: null,
user: null,
data_base: null,
......@@ -105,7 +114,8 @@
componentBottomLine,
componentGoodsSpecChoice,
componentGoodsBuy,
componentBadge
componentBadge,
componentSharePopup
},
onLoad(params) {
......@@ -371,6 +381,13 @@
}
temp['goods'][back.index] = goods;
this.setData({data: temp});
},
// 分享开启弹层
share_event(e) {
if((this.$refs.share || null) != null) {
this.$refs.share.init();
}
}
}
};
......
......@@ -213,7 +213,7 @@
}
},
fail: () => {
app.globalData.showToast("省份信息失败");
app.globalData.showToast("获取数据失败");
}
});
},
......
......@@ -10,7 +10,7 @@
<image :src="detail.avatar" class="avatar dis-block circle fl" mode="widthFix" @tap="avatar_event" :data-value="detail.avatar"></image>
</view>
</view>
<view v-for="(item, index) in detail_list" :key="index" class="item br-b oh padding-vertical-main">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
<view class="title fl padding-right-main cr-gray">{{item.name}}</view>
<view class="content fl br-l padding-left-main">{{item.value}}</view>
</view>
......
......@@ -4,7 +4,7 @@
<view class="padding-horizontal-main padding-top-main">
<view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
<view class="panel-content oh">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b oh padding-vertical-main">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
<view class="title fl padding-right-main cr-gray">{{item.name}}</view>
<view class="content fl br-l padding-left-main">{{item.value}}</view>
</view>
......
/**
* 基础
*/
.base-container .icon {
width: 50rpx;
height: 50rpx;
}
.base-container .title {
width: calc(100% - 240rpx);
}
.base-container .share-submit {
line-height: 50rpx;
height: 50rpx;
}
/**
* 商品列表
*/
.data-list .item .goods-img {
width:170rpx;
height: 170rpx !important;
}
.data-list .item .right-base {
width: calc(100% - 190rpx);
}
.data-list .item .spec-text {
width: calc(100% - 240rpx);
}
/**
* 数量操作
*/
.data-list .item .number-content {
right: 20rpx;
bottom: 20rpx;
border: 1px solid #f0f0f0;
}
.data-list .item .number-content .number-submit {
width: 60rpx;
font-weight: bold;
}
.data-list .item .number-content input {
width: 50px;
border-width: 0 1px 0 1px;
border-style: solid;
border-color: #f0f0f0;
}
.data-list .item .number-content .number-submit,
.data-list .item .number-content input {
padding: 0;
height: 50rpx;
line-height: 50rpx;
}
/**
* 导航
*/
.nav-button {
box-shadow: 0 -2px 6px #e2e2e2;
}
.nav-button .left-price {
width: calc(100% - 270rpx);
}
.nav-button .right-button {
width: 250rpx;
}
\ No newline at end of file
<template>
<view>
<view v-if="(data || null) != null" class="page-bottom-fixed">
<view class="padding-horizontal-main padding-top-main">
<!-- 基础信息 -->
<view class="base-container oh spacing-mb">
<image v-if="(data.icon || null) != null" class="dis-inline-block border-radius-main br va-m margin-right-sm icon" :src="data.icon" mode="aspectFit"></image>
<view class="text-size cr-base fw dis-inline-block va-m title">{{data.title}}</view>
<button class="round bg-white br-green cr-green fr share-submit" type="default" size="mini" hover-class="none" @tap="share_event" :data-index="index">
<uni-icons type="redo" size="34rpx" color="#1AAD19" class="va-m"></uni-icons>
<text class="va-m">分享</text>
</button>
</view>
<view v-if="(data.detail_list || null) != null && data.detail_list.length > 0">
<!-- 商品 -->
<view class="data-list oh">
<view v-for="(item, index) in data.detail_list" :key="index" :class="'item padding-main border-radius-main bg-white oh pr spacing-mb '+(item.goods.is_error == 0 ? '' : 'br-red')">
<image class="goods-img dis-block border-radius-main fl" :src="item.goods.images" mode="aspectFit" :data-value="item.goods.goods_url" @tap="url_event"></image>
<view class="right-base fr">
<label v-if="item.goods.is_error == 0" class="fr" :data-index="index" @tap="goods_choice_event">
<radio :checked="(item.checked == undefined || item.checked == true)" style="transform:scale(0.9)" />
</label>
<view class="single-text padding-right">{{item.goods.title}}</view>
<view class="single-text margin-top-lg">
<text class="sales-price">{{currency_symbol}}{{item.goods.price}}</text>
<text v-if="item.goods.original_price != 0" class="original-price margin-left-sm">{{currency_symbol}}{{item.goods.original_price}}</text>
<text class="cr-grey text-size-xs fr">{{item.goods.inventory}}{{item.goods.inventory_unit}}</text>
</view>
<view class="margin-top-sm">
<view v-if="item.goods.is_error == 0">
<view v-if="(item.spec_text_view || null) != null" class="cr-grey text-size-xs spec-text">{{item.spec_text_view}}</view>
<view class="number-content tc oh round pa">
<view class="number-submit tc cr-gray fl va-m" data-type="0" :data-index="index" @tap="goods_buy_number_event">-</view>
<input class="tc cr-gray bg-white fl va-m radius-0" type="number" :value="item.stock || item.goods.buy_min_number || 1" :data-index="index" @blur="goods_buy_number_blur">
<view class="number-submit tc cr-gray fl va-m" data-type="1" :data-index="index" @tap="goods_buy_number_event">+</view>
</view>
</view>
<view v-else class="cr-yellow text-size-xs">{{item.error_msg}}</view>
</view>
</view>
</view>
</view>
<!-- 导航 -->
<view class="nav-button bottom-fixed padding-main pr bg-white">
<view class="bottom-line-exclude oh">
<view class="left-price fl">
<view class="sales-price single-text margin-top-sm">{{currency_symbol}}{{data.total_price}}</view>
</view>
<view class="right-button fr tr">
<button type="default" size="mini" class="bg-main br-main cr-white round dis-block text-size-sm" @tap="buy_event">立即购买</button>
</view>
</view>
</view>
</view>
<view v-else>
<!-- 提示信息 -->
<component-no-data propStatus="0" propMsg="没有相关商品"></component-no-data>
</view>
</view>
<!-- 结尾 -->
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
<!-- 分享弹窗 -->
<component-share-popup ref="share"></component-share-popup>
</view>
<view v-else>
<!-- 提示信息 -->
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
</view>
</view>
</template>
<script>
const app = getApp();
import base64 from '../../../../common/js/lib/base64.js';
import componentNoData from "../../../../components/no-data/no-data";
import componentBottomLine from "../../../../components/bottom-line/bottom-line";
import componentSharePopup from "../../../../components/share-popup/share-popup";
export default {
data() {
return {
data_bottom_line_status: false,
data_list_loding_status: 1,
data_list_loding_msg: '',
currency_symbol: app.globalData.currency_symbol(),
params: null,
user: null,
data_base: null,
data: null,
// 自定义分享信息
share_info: {}
};
},
components: {
componentNoData,
componentBottomLine,
componentSharePopup
},
onLoad(params) {
this.setData({
params: params
});
},
onShow() {
// 初始化配置
this.init_config();
// 获取数据
this.get_data();
},
// 下拉刷新
onPullDownRefresh() {
this.get_data();
},
methods: {
// 初始化配置
init_config(status) {
if ((status || false) == true) {
this.setData({
currency_symbol: app.globalData.get_config('currency_symbol'),
});
} else {
app.globalData.is_config(this, 'init_config');
}
},
// 获取数据
get_data() {
uni.showLoading({
title: '加载中...'
});
uni.request({
url: app.globalData.get_request_url("detail", "recommend", "distribution"),
method: 'POST',
data: {
id: this.params.id || 0
},
dataType: 'json',
success: res => {
uni.hideLoading();
uni.stopPullDownRefresh();
if (res.data.code == 0) {
var data = res.data.data;
this.setData({
data: data || null,
data_list_loding_msg: '',
data_list_loding_status: 0,
data_bottom_line_status: ((data || null) != null)
});
if ((this.data || null) != null) {
// 基础自定义分享
this.setData({
share_info: {
title: this.data.seo_title || this.data.title,
desc: this.data.seo_desc || this.data.describe,
path: '/pages/plugins/distribution/recommend-detail/recommend-detail',
query: 'id='+this.data.id,
img: this.data.icon || ''
}
});
// 标题
if((this.data.title || null) != null) {
uni.setNavigationBarTitle({
title: this.data.title
});
}
}
} else {
this.setData({
data_bottom_line_status: false,
data_list_loding_status: 2,
data_list_loding_msg: res.data.msg
});
}
// 分享菜单处理
app.globalData.page_share_handle(this.share_info);
},
fail: () => {
uni.hideLoading();
uni.stopPullDownRefresh();
this.setData({
data_bottom_line_status: false,
data_list_loding_status: 2,
data_list_loding_msg: '服务器请求出错'
});
app.globalData.showToast('服务器请求出错');
}
});
},
// url事件
url_event(e) {
app.globalData.url_event(e);
},
// 商品选择事件
goods_choice_event(e) {
// 选择处理
var index = e.currentTarget.dataset.index || 0;
var temp_data = this.data;
var detail_list = temp_data.detail_list;
detail_list[index]['checked'] = (detail_list[index]['checked'] == undefined || detail_list[index]['checked'] == true) ? false : true;
temp_data['detail_list'] = detail_list;
this.setData({data: temp_data});
// 导航总数处理
this.nav_total_handle();
},
// 导航总数处理
nav_total_handle() {
var temp_data = this.data;
var detail_list = temp_data.detail_list;
var total_price = 0;
for(var i in detail_list) {
if((detail_list[i]['checked'] == undefined || detail_list[i]['checked'] == true) && detail_list[i]['goods']['is_error'] == 0) {
var stock = parseInt(detail_list[i]['stock'] || detail_list[i]['goods']['buy_min_number'] || 1);
total_price += parseFloat(detail_list[i]['goods']['price'] || 0)*stock;
}
}
temp_data['total_price'] = app.globalData.price_two_decimal(total_price);
this.setData({data: temp_data});
},
// 立即购买
buy_event(e) {
// 是否需要选择商品
var type = parseInt(this.data.type || 0);
var goods_data = [];
var temp_goods = this.data.detail_list;
for(var i in temp_goods) {
if(temp_goods[i]['goods']['is_error'] == 0 && (temp_goods[i]['checked'] == undefined || temp_goods[i]['checked'] == true)) {
goods_data.push({
goods_id: temp_goods[i]['goods']['id'],
stock: temp_goods[i]['stock'] || temp_goods[i]['goods']['buy_min_number'] || 1,
spec: temp_goods[i]['spec'] || ''
});
}
}
var buy_min_number = 1;
if(goods_data.length < buy_min_number) {
app.globalData.showToast('请至少选择'+buy_min_number+'个商品');
return false;
}
// 进入订单确认页面
var data = {
buy_type: "goods",
goods_data: encodeURIComponent(base64.encode(JSON.stringify(goods_data)))
};
uni.navigateTo({
url: '/pages/buy/buy?data=' + encodeURIComponent(base64.encode(JSON.stringify(data)))
});
},
// 数量输入事件
goods_buy_number_blur(e) {
var index = e.currentTarget.dataset.index || 0;
var temp_data = this.data;
var detail_list = temp_data.detail_list;
var item = detail_list[index];
var goods = item['goods'];
var number = parseInt(e.detail.value) || 1;
if(isNaN(number)) {
number = goods['buy_min_number'] || 1;
}
this.goods_stock_handle(index, temp_data, detail_list, item, goods, number);
},
// 数量操作事件
goods_buy_number_event(e) {
var type = parseInt(e.currentTarget.dataset.type || 0);
var index = e.currentTarget.dataset.index || 0;
var temp_data = this.data;
var detail_list = temp_data.detail_list;
var item = detail_list[index];
var goods = item['goods'];
var temp_stock = parseInt(item['stock'] || goods['buy_min_number'] || 1);
var number = (type == 0) ? temp_stock - 1 : temp_stock + 1;
this.goods_stock_handle(index, temp_data, detail_list, item, goods, number);
},
// 数量处理方法
goods_stock_handle(index, temp_data, detail_list, item, goods, number) {
var buy_min_number = parseInt(goods.buy_min_number || 1);
var buy_max_number = parseInt(goods.buy_max_number || 0);
var inventory = parseInt(goods.inventory || 0);
var inventory_unit = goods.inventory_unit;
// 最小起购数量
if (buy_min_number > 0 && number < buy_min_number) {
number = buy_min_number;
app.globalData.showToast('起购' + buy_min_number + inventory_unit);
}
// 最大购买数量
if (buy_max_number > 0 && number > buy_max_number) {
number = buy_max_number;
app.globalData.showToast('限购' + buy_max_number + inventory_unit);
}
// 是否超过库存数量
if (number > inventory) {
number = inventory;
app.globalData.showToast('库存数量' + inventory + inventory_unit);
}
// 获取数据
var data = this.params;
data['id'] = goods.id;
data['spec'] = item.spec || '';
data['stock'] = number;
uni.request({
url: app.globalData.get_request_url('stock', 'goods'),
method: 'POST',
data: data,
dataType: 'json',
success: res => {
if (res.data.code == 0) {
// 基础数据
detail_list[index]['stock'] = number;
detail_list[index]['goods']['price'] = res.data.data.spec_base.price;
detail_list[index]['goods']['original_price'] = res.data.data.spec_base.original_price;
detail_list[index]['goods']['inventory'] = res.data.data.spec_base.inventory;
temp_data['detail_list'] = detail_list;
this.setData({
data: temp_data
});
// 导航总数处理
this.nav_total_handle();
} else {
app.globalData.showToast(res.data.msg);
}
},
fail: () => {
app.globalData.showToast('服务器请求出错');
}
});
},
// 分享开启弹层
share_event(e) {
if((this.$refs.share || null) != null) {
this.$refs.share.init();
}
}
}
};
</script>
<style>
@import './recommend-detail.css';
</style>
\ No newline at end of file
/**
* 商品列表
*/
.view-goods-list image {
width: 130rpx;
height: 130rpx;
}
.view-goods-list .base {
width: calc(100% - 150rpx);
}
.view-goods-list .operate-submit {
right: 0;
bottom: 0;
}
/**
* 商品选择弹窗
*/
.popup-goods-choice-container .nav-search {
height: 90rpx;
}
.popup-goods-choice-container .nav-search .item {
width: calc(50% - 124rpx);
height: 60rpx;
line-height: 60rpx;
}
.popup-goods-choice-container .nav-search input.item,
.popup-goods-choice-container .nav-search button {
height: 64rpx;
line-height: 64rpx;
}
.popup-goods-choice-container .view-goods-list {
height: 80vh;
overflow-y: scroll;
overflow-x: hidden;
}
\ No newline at end of file
.add-submit {
position: fixed;
bottom: 50rpx;
right: 50rpx;
width: 100rpx;
height: 100rpx;
line-height: 86rpx;
box-shadow: 0 0 10px 2px #c4c4c4;
font-size: 76rpx;
}
\ No newline at end of file
<template>
<view>
<!-- 列表 -->
<scroll-view :scroll-y="true" class="scroll-box" @scrolltolower="scroll_lower" lower-threshold="60">
<view v-if="data_list.length > 0" class="data-list padding-horizontal-main padding-top-main">
<view v-for="(item, index) in data_list" :key="index" class="item padding-main border-radius-main oh bg-white spacing-mb">
<view class="base oh br-b padding-bottom-main">
<text class="cr-base">{{item.add_time}}</text>
<text :class="'fr '+(item.is_enable == 1 ? 'cr-green' : 'cr-grey')">{{item.is_enable_text}}</text>
</view>
<view class="content margin-top">
<navigator :url="'/pages/plugins/distribution/recommend-detail/recommend-detail?id=' + item.id" hover-class="none">
<block v-for="(fv,fi) in content_list" :key="fi">
<view class="single-text margin-top-xs">
<text class="cr-gray margin-right-xl">{{fv.name}}</text>
<text class="cr-base">{{item[fv.field]}}</text>
</view>
</block>
</navigator>
</view>
<view class="item-operation tr br-t padding-top-main margin-top-main">
<button class="round bg-white br-green cr-green" type="default" size="mini" hover-class="none" @tap="popup_share_event" :data-index="index">分享</button>
<navigator :url="'/pages/plugins/distribution/recommend-form/recommend-form?id='+item.id" hover-class="none" class="dis-inline-block margin-left-lg">
<button class="round bg-white br-main cr-main" type="default" size="mini" hover-class="none">编辑</button>
</navigator>
<button class="round bg-white br-red cr-red margin-left-lg" type="default" size="mini" hover-class="none" @tap="delete_event" :data-index="index">删除</button>
</view>
</view>
</view>
<view v-else>
<!-- 提示信息 -->
<component-no-data :propStatus="data_list_loding_status"></component-no-data>
</view>
<!-- 结尾 -->
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
</scroll-view>
<!-- 新增入口 -->
<navigator url="/pages/plugins/distribution/recommend-form/recommend-form" hover-class="none">
<view class="add-submit bg-main cr-white round tc">+</view>
</navigator>
<!-- 分享弹窗 -->
<component-share-popup ref="share"></component-share-popup>
</view>
</template>
<script>
const app = getApp();
import componentNoData from "../../../../components/no-data/no-data";
import componentBottomLine from "../../../../components/bottom-line/bottom-line";
import componentSharePopup from "../../../../components/share-popup/share-popup";
export default {
data() {
return {
data_list: [],
data_total: 0,
data_page_total: 0,
data_page: 1,
data_list_loding_status: 1,
data_bottom_line_status: false,
data_is_loading: 0,
params: null,
content_list: [
{name: "标题", field: "title"},
{name: "描述", field: "describe"},
{name: "商品", field: "goods_count"},
{name: "访问", field: "access_count"}
],
// 自定义分享信息
share_info: {}
};
},
components: {
componentNoData,
componentBottomLine,
componentSharePopup
},
props: {},
onShow() {
// 数据加载
this.init();
},
// 下拉刷新
onPullDownRefresh() {
this.setData({
data_page: 1
});
this.get_data_list(1);
},
methods: {
init() {
var user = app.globalData.get_user_info(this, 'init');
if (user != false) {
// 用户未绑定用户则转到登录页面
if (app.globalData.user_is_need_login(user)) {
uni.redirectTo({
url: "/pages/login/login?event_callback=init"
});
return false;
} else {
// 获取数据
this.get_data_list();
}
} else {
this.setData({
data_list_loding_status: 0,
data_bottom_line_status: false
});
}
},
// 获取数据
get_data_list(is_mandatory) {
// 分页是否还有数据
if ((is_mandatory || 0) == 0) {
if (this.data_bottom_line_status == true) {
uni.stopPullDownRefresh();
return false;
}
}
// 是否加载中
if(this.data_is_loading == 1) {
return false;
}
this.setData({
data_is_loading: 1,
data_list_loding_status: 1
});
// 加载loding
uni.showLoading({
title: '加载中...'
});
// 参数
uni.request({
url: app.globalData.get_request_url("index", "recommend", "distribution"),
method: 'POST',
data: {
page: this.data_page,
is_more: 1
},
dataType: 'json',
success: res => {
uni.hideLoading();
uni.stopPullDownRefresh();
if (res.data.code == 0) {
if (res.data.data.data.length > 0) {
if (this.data_page <= 1) {
var temp_data_list = res.data.data.data;
} else {
var temp_data_list = this.data_list || [];
var temp_data = res.data.data.data;
for (var i in temp_data) {
temp_data_list.push(temp_data[i]);
}
}
this.setData({
data_list: temp_data_list,
data_total: res.data.data.total,
data_page_total: res.data.data.page_total,
data_list_loding_status: 3,
data_page: this.data_page + 1,
data_is_loading: 0
});
// 是否还有数据
this.setData({
data_bottom_line_status: (this.data_page > 1 && this.data_page > this.data_page_total)
});
} else {
this.setData({
data_list_loding_status: 0,
data_list: [],
data_bottom_line_status: false,
data_is_loading: 0
});
}
} else {
this.setData({
data_list_loding_status: 0,
data_is_loading: 0
});
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
app.globalData.showToast(res.data.msg);
}
}
},
fail: () => {
uni.hideLoading();
uni.stopPullDownRefresh();
this.setData({
data_list_loding_status: 2,
data_is_loading: 0
});
app.globalData.showToast('服务器请求出错');
}
});
},
// 滚动加载
scroll_lower(e) {
this.get_data_list();
},
// 分享开启弹层
popup_share_event(e) {
var index = e.currentTarget.dataset.index || 0;
var data = this.data_list[index] || null;
if(data == null) {
app.globalData.showToast('数据有误');
return false;
}
this.setData({
share_info: {
title: data.seo_title || data.title,
kds: data.seo_keywords || data.describe,
desc: data.seo_desc || data.describe,
path: '/pages/plugins/distribution/recommend-detail/recommend-detail',
query: 'id=' + data.id,
img: data.icon || ''
}
});
// 分享菜单处理
app.globalData.page_share_handle(this.share_info);
// 调取分享弹窗
if((this.$refs.share || null) != null) {
this.$refs.share.init();
}
},
// 删除数据
delete_event(e) {
var index = e.currentTarget.dataset.index || 0;
var temp_data = this.data_list;
var data = temp_data[index] || null;
if(data == null) {
app.globalData.showToast('数据有误');
return false;
}
uni.showModal({
title: '温馨提示',
content: '删除后不可恢复,确定继续吗?',
confirmText: '确认',
cancelText: '不了',
success: result => {
if (result.confirm) {
uni.showLoading({
title: '处理中...'
});
uni.request({
url: app.globalData.get_request_url("delete", "recommend", "distribution"),
method: 'POST',
data: {ids: data.id},
dataType: 'json',
success: res => {
uni.hideLoading();
if (res.data.code == 0) {
temp_data.splice(index, 1);
this.setData({
data_list: temp_data
});
app.globalData.showToast(res.data.msg, 'success');
} else {
app.globalData.showToast(res.data.msg);
}
},
fail: () => {
uni.hideLoading();
app.globalData.showToast('服务器请求出错');
}
});
}
}
});
}
}
};
</script>
<style>
@import './recommend-list.css';
</style>
\ No newline at end of file
......@@ -18,7 +18,7 @@
</block>
</view>
<view class="item-operation tr br-t padding-top-main margin-top-main">
<button class="round bg-white br cr-base br" type="default" size="mini" hover-class="none" @tap="user_order_event" :data-value="item.id">用户订单</button>
<button class="round bg-white br cr-base" type="default" size="mini" hover-class="none" @tap="user_order_event" :data-value="item.id">用户订单</button>
</view>
</view>
</view>
......
......@@ -4,7 +4,7 @@
<view class="padding-horizontal-main padding-top-main">
<view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
<view class="panel-content oh">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b oh padding-vertical-main">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
<view class="title fl padding-right-main cr-gray">{{item.name}}</view>
<view class="content fl br-l padding-left-main">{{item.value}}</view>
</view>
......
......@@ -5,7 +5,7 @@
<view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
<view class="br-b padding-bottom-main fw-b text-size">申请信息</view>
<view class="panel-content oh">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b oh padding-vertical-main">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
<view class="title fl padding-right-main cr-gray">{{item.name}}</view>
<view class="content fl br-l padding-left-main">{{item.value}}</view>
</view>
......
......@@ -4,7 +4,7 @@
<view class="padding-horizontal-main padding-top-main">
<view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
<view class="panel-content oh">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b oh padding-vertical-main">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
<view class="title fl padding-right-main cr-gray">{{item.name}}</view>
<view class="content fl br-l padding-left-main">{{item.value}}</view>
</view>
......
......@@ -4,7 +4,7 @@
<view class="padding-horizontal-main padding-top-main">
<view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
<view class="panel-content oh">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b oh padding-vertical-main">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
<view class="title fl padding-right-main cr-gray">{{item.name}}</view>
<view class="content fl br-l padding-left-main">{{item.value}}</view>
</view>
......
......@@ -78,7 +78,7 @@
<view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
<view class="br-b padding-bottom-main fw-b text-size">订单信息</view>
<view class="panel-content oh">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b oh padding-vertical-main">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
<view class="title fl padding-right-main cr-gray">{{item.name}}</view>
<view class="content fl br-l padding-left-main">{{item.value}}</view>
</view>
......
......@@ -5,7 +5,7 @@
<view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
<view class="br-b padding-bottom-main fw-b text-size">基础信息</view>
<view class="panel-content oh">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b oh padding-vertical-main">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
<view class="title fl padding-right-main cr-gray">{{item.name}}</view>
<view class="content fl br-l padding-left-main">{{item.value}}</view>
</view>
......
......@@ -4,7 +4,7 @@
<view class="padding-horizontal-main padding-top-main">
<view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
<view class="panel-content oh">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b oh padding-vertical-main">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
<view class="title fl padding-right-main cr-gray">{{item.name}}</view>
<view class="content fl br-l padding-left-main">{{item.value}}</view>
</view>
......
......@@ -4,7 +4,7 @@
<view class="padding-horizontal-main padding-top-main">
<view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
<view class="panel-content oh">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b oh padding-vertical-main">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
<view class="title fl padding-right-main cr-gray">{{item.name}}</view>
<view class="content fl br-l padding-left-main">{{item.value}}</view>
</view>
......
......@@ -4,7 +4,7 @@
<view class="padding-horizontal-main padding-top-main">
<view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
<view class="panel-content oh">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b oh padding-vertical-main">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
<view class="title fl padding-right-main cr-gray">{{item.name}}</view>
<view class="content fl br-l padding-left-main">{{item.value}}</view>
</view>
......
......@@ -79,7 +79,7 @@
<view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
<view class="br-b padding-bottom-main fw-b text-size">订单信息</view>
<view class="panel-content oh">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b oh padding-vertical-main">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
<view class="title fl padding-right-main cr-gray">{{item.name}}</view>
<view class="content fl br-l padding-left-main">{{item.value}}</view>
</view>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册