guhongwei 2 سال پیش
والد
کامیت
1609b14283
4فایلهای تغییر یافته به همراه1912 افزوده شده و 96 حذف شده
  1. 139 51
      common/api.js
  2. 132 0
      pagesHome/order/detail - 副本.vue
  3. 1620 0
      pagesHome/order/detail copy.vue
  4. 21 45
      pagesHome/order/detail.vue

+ 139 - 51
common/api.js

@@ -1,6 +1,5 @@
 import config from '../config.js';
 const getDomain = (uri, method, type) => {
-	// let system = config.system;
 	let url = config.serverUrl;
 	if (type && type == 'file') return url + `/files` + uri;
 	if (type && type == 'integral') {
@@ -20,29 +19,6 @@ const getDomain = (uri, method, type) => {
 	if (config.wx_dev) general = url + `${config.wx_dev}` + general;
 	else general = url + general;
 	return general;
-	// if (type && type == 'file') return url + `/files` + uri;
-	// if (type && type == 'integral') {
-	// 	let integral_1 = `/point/zr/v1/api` + uri;
-	// 	if (config.wx_dev) return url + `${config.wx_dev}` + integral_1;
-	// 	else return url + integral_1;
-	// }
-	// if (type && type == 'group') {
-	// 	let group_1 = `/point/group/v1/api` + uri;
-	// 	if (config.wx_dev) return url + `${config.wx_dev}` + group_1;
-	// 	else return url + group_1;
-	// }
-	// if (uri.startsWith('/wechat/api')) return url + uri;
-	// else {
-	// 	if (system.uniPlatform == 'app') {
-	// 		return url + `/point/v1/api` + uri;
-	// 	} else if (system.uniPlatform == 'mp-weixin') {
-	// 		// if (wx_env.envVersion == 'develop' || wx_env.envVersion == 'trial') {
-	// 		// 	return url + `${config.wx_dev}/point/v1/api` + uri;
-	// 		// } else if (wx_env.envVersion == 'release') {
-	// 		// 	return url + '/point/v1/api' + uri;
-	// 		// }
-	// 	}
-	// }
 };
 // 获取token
 const getToken = () => {
@@ -66,13 +42,11 @@ const getRequestKey = (views) => {
 				else reject();
 			},
 			fail: (err) => {
-				console.error(err)
-				reject(err);
+				console.log(err);
 			},
 		});
 	});
 };
-
 export const requestBase = async (uri, method = 'GET', data, type) => {
 	let baseUrl = getDomain(uri, method, type);
 	let token = getToken();
@@ -81,32 +55,146 @@ export const requestBase = async (uri, method = 'GET', data, type) => {
 		uri,
 		method
 	});
-	views = encodeURIComponent(views)
-	if (method !== 'GET') {
-		let rk = await getRequestKey(views);
-		header.rk = rk;
-		header.views = views;
-	}
+	views = encodeURIComponent(views);
 	if (token) header.token = token;
-	return new Promise((resolve, reject) => {
-		uni.request({
-			url: baseUrl,
-			method: method || 'GET',
-			data: data || {},
-			header,
-			success: (res) => {
-				resolve(res.data);
-			},
-			fail: (err) => {
-				console.log(err);
-				uni.showToast({
-					title: '请求接口失败',
-					icon: 'fail',
-				});
-				reject(err.data);
-			},
+	if (method === 'GET') {
+		return new Promise((resolve, reject) => {
+			uni.request({
+				url: baseUrl,
+				method: method || 'GET',
+				data: data || {},
+				header,
+				success: (res) => {
+					resolve(res.data);
+				},
+				fail: (err) => {
+					uni.showToast({
+						title: '请求接口失败',
+						icon: 'fail',
+					});
+					reject(err.data);
+				},
+			});
 		});
-	});
+	} else if (method === 'POST') {
+		header.views = views;
+		return new Promise((resolve, reject) => {
+			// rk配置
+			let rkbaseUrl = getDomain('/util/crk');
+			let pages = getCurrentPages();
+			let route = pages[pages.length - 1].$page.fullPath;
+			uni.request({
+				url: rkbaseUrl,
+				method: 'POST',
+				header: {
+					views,
+					Referer: route,
+				},
+				success: (rkres) => {
+					if (rkres.data && rkres.data.data) header.rk = rkres.data.data;
+					header.Referer = route;
+					uni.request({
+						url: baseUrl,
+						method: 'POST',
+						data: data || {},
+						header,
+						success: (res) => {
+							resolve(res.data);
+						},
+						fail: (err) => {
+							uni.showToast({
+								title: '请求接口失败',
+								icon: 'fail',
+							});
+							reject(err.data);
+						},
+					});
+				},
+
+			});
+			// uni.request({
+			// 	url: baseUrl,
+			// 	method: method || 'GET',
+			// 	data: data || {},
+			// 	header,
+			// 	success: (res) => {
+			// 		resolve(res.data);
+			// 	},
+			// 	fail: (err) => {
+			// 		uni.showToast({
+			// 			title: '请求接口失败',
+			// 			icon: 'fail',
+			// 		});
+			// 		reject(err.data);
+			// 	},
+			// });
+		});
+		// uni.request({
+		// 	url: baseUrl,
+		// 	method: 'POST',
+		// 	header: {
+		// 		views,
+		// 		Referer: route,
+		// 	},
+		// 	success: (rkres) => {
+		// 		if (rkres.data && rkres.data.data) {
+		// 			header.rk = rkres.data.data;
+		// 		}
+
+		// 		return new Promise((resolve, reject) => {
+		// 			uni.request({
+		// 				url: baseUrl,
+		// 				method: method || 'GET',
+		// 				data: data || {},
+		// 				header,
+		// 				success: (res) => {
+		// 					console.log(res);
+		// 					resolve(res.data);
+		// 				},
+		// 				fail: (err) => {
+		// 					uni.showToast({
+		// 						title: '请求接口失败',
+		// 						icon: 'fail',
+		// 					});
+		// 					reject(err.data);
+		// 				},
+		// 			});
+		// 		});
+		// 	},
+		// 	fail: (rkerr) => {
+		// 		console.log(rkerr);
+		// 	},
+		// });
+
+	}
+	// if (method !== 'GET') {
+	// 	header.views = views;
+
+	// 	// rk配置
+	// 	let baseUrl = getDomain('/util/crk');
+	// 	let test = await getRequestKey(views)
+	// 	console.log(test);
+	// 	console.log(header);
+	// }
+	// if (token) header.token = token;
+	// return new Promise((resolve, reject) => {
+	// 	uni.request({
+	// 		url: baseUrl,
+	// 		method: method || 'GET',
+	// 		data: data || {},
+	// 		header,
+	// 		success: (res) => {
+	// 			resolve(res.data);
+	// 		},
+	// 		fail: (err) => {
+	// 			uni.showToast({
+	// 				title: '请求接口失败',
+	// 				icon: 'fail',
+	// 			});
+	// 			reject(err.data);
+	// 		},
+	// 	});
+	// });
 };
 export const requestFile = (uri, method, data, type) => {
 	let baseUrl = getDomain(uri, method, type);

+ 132 - 0
pagesHome/order/detail - 副本.vue

@@ -0,0 +1,132 @@
+<template>
+	<mobile-frame>
+		<view class="main">
+			<view class="one">
+				<scroll-view scroll-y="true" class="scroll-view">
+					<view class="list-scroll-view">
+						<view class="one_1">
+							第一部分
+						</view>
+					</view>
+				</scroll-view>
+			</view>
+		</view>
+	</mobile-frame>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				// 商品id
+				id: '',
+				// 分享人id
+				inviter: '',
+				// 系统设置
+				config: {},
+				// 系统菜单
+				barList: [],
+				// 当前用户信息
+				user: {},
+				// 是否关注商品
+				goodsColect: false,
+				// 是否关注店铺
+				shopColect: false,
+				// 评价数
+				evaluate_num: 2,
+				// 商品详情
+				info: {},
+				infospecs: {},
+				// 优惠
+				discount: {},
+			};
+		},
+		onLoad: async function(e) {
+			const that = this;
+			that.$set(that, `id`, e.id || '');
+			that.$set(that, `inviter`, e.inviter || '');
+			// 系统设置
+			await that.searchConfig();
+			// 数据查询
+			await that.search();
+			// 配置分享内容
+			await that.configShare();
+		},
+		onShow: function() {
+			const that = this;
+			// 当前用户信息
+			that.watchLogin();
+		},
+		onUnload: function() {
+
+		},
+		methods: {
+			// 查询系统设置
+			searchConfig() {
+				const that = this;
+				uni.getStorage({
+					key: 'config',
+					success: function(res) {
+						let data = res.data;
+						that.$set(that, `config`, data);
+						if (data.bottom_menu && data.bottom_menu.list.length > 0) {
+							let list = data.bottom_menu.list.sort((a, b) => {
+								return a.sort - b.sort
+							});
+							that.$set(that, `barList`, list)
+						}
+					}
+				})
+			},
+			// 查询用户信息
+			watchLogin() {
+				const that = this;
+				uni.getStorage({
+					key: 'token',
+					success: function(res) {
+						let user = that.$jwt(res.data);
+						if (user) that.$set(that, `user`, user);
+					},
+					fail: function(err) {
+						console.log('暂无用户信息');
+					}
+				})
+			},
+			// 配置分享内容
+			configShare() {
+				const that = this;
+				let id = that.id;
+				let inviter = that.user && that.user._id ? that.user._id : '';
+				let title = that.info && that.info.goods ? that.info.goods.name : '';
+				let imageUrl = that.info && that.info.goods ? that.info.goods.file[0].url : '';
+				that.$config.share = {
+					title: title,
+					path: `/pagesHome/order/detail?id=${id}&inviter=${inviter}`,
+					imageUrl: imageUrl
+				}
+			},
+			async search() {
+				const that = this;
+				let id = that.id;
+				if (id) {
+					let res;
+					res = await that.$api(`/viewGoods/goodsDetail`, `POST`, {
+						id: id
+					});
+					if (res.errcode == '0') {
+						console.log(res.data);
+					}
+				} else {
+					uni.showToast({
+						title: '暂无商品信息',
+						icon: 'none'
+					})
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+
+</style>

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1620 - 0
pagesHome/order/detail copy.vue


+ 21 - 45
pagesHome/order/detail.vue

@@ -5,8 +5,7 @@
 				<scroll-view scroll-y="true" class="scroll-view">
 					<view class="list-scroll-view">
 						<view class="one_1">
-							<swiper class="swiper" circular :indicator-dots="true" indicator-color="#ffffff"
-								indicator-active-color="#FB1438" :interval="3000" :duration="1000">
+							<swiper class="swiper" circular :indicator-dots="true" indicator-color="#ffffff" indicator-active-color="#FB1438" :interval="3000" :duration="1000">
 								<swiper-item class="list" v-for="(item,index) in info.goods.file" :key="index">
 									<image class="image" :src="item.url" mode="aspectFit">
 									</image>
@@ -14,26 +13,21 @@
 							</swiper>
 							<!-- 是否关注商品 -->
 							<view class="goodsColect">
-								<text @tap="toGoodscolect"
-									:class="['iconfont',goodsColect?'icon-yduishoucangshixin-copy':'icon-yduishoucangkongxin']"></text>
+								<text @tap="toGoodscolect" :class="['iconfont',goodsColect?'icon-yduishoucangshixin-copy':'icon-yduishoucangkongxin']"></text>
 							</view>
 							<view class="acttags" v-if="info.goods.act_tags&&info.goods.act_tags.length>0">
 								<text v-for="i in info.goods.act_tags" :key="i">{{i.label}}</text>
 							</view>
 						</view>
 						<view class="one_2">
-							<text class="money_1"
-								v-if="infospecs.leader_price"><text>团长价¥</text>{{infospecs.leader_price||0}}</text>
+							<text class="money_1" v-if="infospecs.leader_price"><text>团长价¥</text>{{infospecs.leader_price||0}}</text>
 							<text class="money" v-if="infospecs.price"><text>特价¥</text>{{infospecs.price||0}}</text>
-							<text class="money"
-								v-if="!infospecs.price&&!infospecs.leader_price"><text>¥</text>{{infospecs.sell_money||0}}</text>
+							<text class="money" v-if="!infospecs.price&&!infospecs.leader_price"><text>¥</text>{{infospecs.sell_money||0}}</text>
 							<text class="money"><text>¥</text>{{infospecs.flow_money||0}}</text>
 						</view>
 						<view class="one_3" v-if="discount">
-							<text v-if="discount.full_decrement" class="act"
-								v-for="(item,index) in discount.full_decrement" :key="index">{{item}}</text>
-							<text v-if="discount.full_fold" class="act" v-for="(item,index) in discount.full_fold"
-								:key="index">{{item}}</text>
+							<text v-if="discount.full_decrement" class="act" v-for="(item,index) in discount.full_decrement" :key="index">{{item}}</text>
+							<text v-if="discount.full_fold" class="act" v-for="(item,index) in discount.full_fold" :key="index">{{item}}</text>
 						</view>
 						<view class="one_3">
 							<text class="num">已售{{info.goods.sell_num||0}}件</text>
@@ -80,8 +74,7 @@
 							</view>
 							<view class="one_7_2">
 								<view class="image" v-for="(set,index) in info.sets[0].set" :key="index">
-									<image class="image" :src="set.file&&set.file.length>0?set.file[0].url:''"
-										mode="aspectFit">
+									<image class="image" :src="set.file&&set.file.length>0?set.file[0].url:''" mode="aspectFit">
 									</image>
 								</view>
 								<view class="money">
@@ -93,9 +86,7 @@
 						<view class="one_8">
 							<view class="one_8_1">
 								<view class="shop_1">
-									<image class="image"
-										:src="info.shop.logo&&info.shop.logo.length>0?info.shop.logo[0].url:''"
-										mode="aspectFit"></image>
+									<image class="image" :src="info.shop.logo&&info.shop.logo.length>0?info.shop.logo[0].url:''" mode="aspectFit"></image>
 								</view>
 								<view class="shop_2">
 									<view class="name">{{info.shop.name}}</view>
@@ -134,8 +125,7 @@
 				</scroll-view>
 			</view>
 			<view class="two">
-				<uni-goods-nav :options="options" :button-group="buttonGroup" @click="toNavleft"
-					@buttonClick="toNavright" />
+				<uni-goods-nav :options="options" :button-group="buttonGroup" @click="toNavleft" @buttonClick="toNavright" />
 			</view>
 		</view>
 		<!-- 跳转菜单 -->
@@ -143,8 +133,7 @@
 			<text @tap="toMenubar" class="iconfont icon-gengduo"></text>
 		</view>
 		<view class="bar_2" v-if="is_menu">
-			<view class="list" v-for="(item,index) in barList" :key="index" v-if="item.is_use=='0'"
-				@click="toPath(item)">
+			<view class="list" v-for="(item,index) in barList" :key="index" v-if="item.is_use=='0'" @click="toPath(item)">
 				<image class="image" :src="item.normal&&item.normal.length>0?item.normal[0].url:''"></image>
 				<text class="name"> {{item.name}}</text>
 			</view>
@@ -162,18 +151,13 @@
 								<view class="one">
 									<view class="one_1">
 										<view class="l">
-											<image class="image"
-												:src="specsInfo.file.length>0?specsInfo.file[0].url:info.goods.file[0].url"
-												mode="aspectFill" @tap="diaView"></image>
+											<image class="image" :src="specsInfo.file.length>0?specsInfo.file[0].url:info.goods.file[0].url" mode="aspectFill" @tap="diaView"></image>
 										</view>
 										<view class="r">
 											<view class="money">
-												<text v-if="specsInfo.leader_price"
-													class="money_2"><text>团长价¥</text>{{specsInfo.leader_price}}</text>
-												<text v-if="specsInfo.price"
-													class="money_1"><text>特价¥</text>{{specsInfo.price}}</text>
-												<text v-if="!specsInfo.price&&!specsInfo.leader_price"
-													class="money_1"><text>¥</text>{{specsInfo.sell_money}}</text>
+												<text v-if="specsInfo.leader_price" class="money_2"><text>团长价¥</text>{{specsInfo.leader_price}}</text>
+												<text v-if="specsInfo.price" class="money_1"><text>特价¥</text>{{specsInfo.price}}</text>
+												<text v-if="!specsInfo.price&&!specsInfo.leader_price" class="money_1"><text>¥</text>{{specsInfo.sell_money}}</text>
 												<text class="money_1"><text>¥</text>{{specsInfo.flow_money}}</text>
 											</view>
 											<view class="other_1">
@@ -191,9 +175,7 @@
 											规格
 										</view>
 										<view class="one_2_2">
-											<view
-												:class="['list',is_specs!=index&&item.num>0?'list':is_specs!=index&&item.num<=0?'huilist':is_specs==index&&item.num>0?'redlist':is_specs==index&&item.num<=0?'huiilist':'list']"
-												v-for="(item,index) in info.specs" :key="index" @tap="toSpecs(item)">
+											<view :class="['list',is_specs!=index&&item.num>0?'list':is_specs!=index&&item.num<=0?'huilist':is_specs==index&&item.num>0?'redlist':is_specs==index&&item.num<=0?'huiilist':'list']" v-for="(item,index) in info.specs" :key="index" @tap="toSpecs(item)">
 												<text>{{item.name}}</text>
 											</view>
 										</view>
@@ -203,13 +185,11 @@
 											<text>数量</text>
 										</view>
 										<view class="one_3_1">
-											<uni-number-box v-model="buy_num" @change="toCount" :min="1"
-												:max="specsInfo.num">
+											<uni-number-box v-model="buy_num" @change="toCount" :min="1" :max="specsInfo.num">
 											</uni-number-box>
 										</view>
 										<view class="one_3_1">
-											<text>库存{{specsInfo.num||0}}</text><text class="limit"
-												v-if="specsInfo.limit_num">({{specsInfo.buy_name||'暂无'}}{{specsInfo.limit_num||0}}个)</text>
+											<text>库存{{specsInfo.num||0}}</text><text class="limit" v-if="specsInfo.limit_num">({{specsInfo.buy_name||'暂无'}}{{specsInfo.limit_num||0}}个)</text>
 										</view>
 									</view>
 								</view>
@@ -247,8 +227,7 @@
 								<view class="title_2" v-if="item.type=='2'">
 									<view class="specList" v-for="(tag,indexx) in item.list" :key="indexx">
 										<view class="name">规格:{{tag.spec_name}}</view>
-										<view class="giftList" v-for="(tags,indexs) in tag.gift" :key="indexs"
-											@tap.stop="tags.type=='0' && getDetail(tags)">
+										<view class="giftList" v-for="(tags,indexs) in tag.gift" :key="indexs" @tap.stop="tags.type=='0' && getDetail(tags)">
 											<view class="left">
 												<view class="goods">{{tags.goods_name}}{{tags.spec_name}}</view>
 												<view class="goods">{{tags.desc}}</view>
@@ -270,10 +249,8 @@
 								<view class="list" v-for="(item,index) in info.sets" :key="index">
 									<view class="name"><text class="set">套装</text>{{item.name}}</view>
 									<view class="set">
-										<view class="set_1" v-for="(tag,indexx) in item.set" :key="indexx"
-											@tap="toDeatil(tag)">
-											<image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''"
-												mode="aspectFit">
+										<view class="set_1" v-for="(tag,indexx) in item.set" :key="indexx" @tap="toDeatil(tag)">
+											<image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''" mode="aspectFit">
 											</image>
 											<view class="goods textOver">{{tag.goods_name}}</view>
 											<view class="spec textOver">{{tag.spec_name}}</view>
@@ -299,8 +276,7 @@
 				<swiper class="swiper" circular @change="diaSpecs" :current="is_specs">
 					<swiper-item class="list" v-for="(item,index) in info.specs" :key="index">
 						<view class="list_1">
-							<image class="image" :src="item.file.length>0?item.file[0].url:info.goods.file[0].url"
-								mode="aspectFit"></image>
+							<image class="image" :src="item.file.length>0?item.file[0].url:info.goods.file[0].url" mode="aspectFit"></image>
 						</view>
 						<view class="name">
 							<text>{{item.name}}</text>