lalala 6 лет назад
Родитель
Сommit
23e073d9b9

+ 4 - 0
mobile-code/src/App.vue

@@ -9,6 +9,10 @@ export default {
 	},
 	onLaunch() {
 		// this.getAllOptions()
+		// 删除缓存
+		if (process.env.NODE_ENV == 'production') {
+			uni.removeStorageSync('shopUser')
+		}
 		// #ifdef MP-WEIXIN
 		// wxLoginFn()
 		// uni.clearStorage()

+ 9 - 8
mobile-code/src/components/app-delivery.vue

@@ -60,8 +60,8 @@
 			<tui-list-cell class="line-cell" :hover="false">
 				<div class="gift-content">
 					<div class="flex-center">
-						<checkbox class="ljd-checkbox" :checked="form.needCard == 1 ? true : false" @change="needCardChange"></checkbox>
-						<span class="need-gift">需要贺卡</span>
+						<checkbox class="ljd-checkbox" id="needGift" :checked="form.needCard == 1 ? true : false" @change="needCardChange"></checkbox>
+						<label for="needGift" class="need-gift">需要贺卡</label>
 					</div>
 					<div class="gitf-textarea">
 						<textarea v-model="form.cardInfo" class="tui-textarea" placeholder-class="phcolor" name="cardInfo" placeholder="请填写贺卡内容" auto-height />
@@ -69,14 +69,14 @@
 					</div>
 				</div>
 			</tui-list-cell>
-			<block v-if="form.anonymous">
+			<!-- <block v-if="form.anonymous"> -->
 				<tui-list-cell class="line-cell" :hover="false">
 					<div class="none-name-delivery flex-center">
-						<checkbox class="ljd-checkbox" @change="anonymityChange"></checkbox>
-						<span class="none-name-text">匿名派送</span>
+						<checkbox class="ljd-checkbox" id="noneNameText" @change="anonymityChange"></checkbox>
+						<label for="noneNameText" class="none-name-text">匿名派送</label>
 					</div>
 				</tui-list-cell>
-			</block>
+			<!-- </block> -->
 		</div>
 		<!-- 备注 -->
 		<div class="module-com remark-wrap">
@@ -161,9 +161,10 @@
 				this.form.receiveProvince = this.orderShop.shop.shopProvince ? this.orderShop.shop.shopProvince : ''
 				this.form.receiveCity = this.orderShop.shop.shopCity ? this.orderShop.shop.shopCity : ''
 			}
-			if (this.anonymous) {
+			// console.log('江总', this.anonymous)
+			// if (this.anonymous) {
 				this.form.anonymous = '0'
-			}
+			// }
 		},
 		methods: {
 			selTimeFn(e) {

+ 3 - 1
mobile-code/src/components/module/app-order-list.vue

@@ -7,7 +7,9 @@
 				</div>
 				<div class="list-msg">
 					<div class="title">{{ info.goodsName || info.title }}</div>
-					<div class="desc">{{ info.goodsStyle || info.goodsStyleName }}</div>
+					<block v-if="(info.goodsStyle && info.goodsStyle != '0') || (info.goodsStyleName  && info.goodsStyleName != '0')">
+						<div class="desc">{{ info.goodsStyle || info.goodsStyleName }}</div>
+					</block>
 				</div>
 			</div>
 			<div class="list-right">

+ 5 - 1
mobile-code/src/components/module/app-share-mask.vue

@@ -7,7 +7,7 @@
 				</div>
 				<div class="share-text">
 					<div>点此右上角</div>
-					<div>分享即可邀请</div>
+					<div>{{ text }}</div>
 				</div>
 			</div>
 			<div class="share-btn">
@@ -25,6 +25,10 @@ export default {
 		show: {
 			type: Boolean,
 			default: false
+		},
+		text: {
+			type: String,
+			default: '分享即可邀请'
 		}
 	},
 	data() {

+ 10 - 6
mobile-code/src/pages/callback/index.vue

@@ -121,7 +121,9 @@ export default {
 			passwordModal: false,
 			form: {
 				payPassword: ''
-			}
+			},
+
+			payCallData: {}
 		}
 	},
 	computed: {
@@ -158,7 +160,9 @@ export default {
 				.then(res => {
 					this.modalCancel()
 					this.$msg('支付成功!')
-					this.paySuccess(res)
+
+					this.payCallData = res.data
+					this.paySuccess()
 				})
 				.catch(e => {
 					this.$msg(e.msg)
@@ -171,19 +175,19 @@ export default {
 				orderSn: this.option.orderSn,
 				couponId: this.option.couponId
 			}).then(res => {
+				this.payCallData = res.data
 				wexinPay(res.data, this.paySuccess, this.payFail)
 			})
 		},
-		paySuccess(res) {
-			// alert('支付成功!')
+		paySuccess() {
 			this.$util.pageTo({
 				url: '/pages/callback/index',
 				type: 2,
 				query: {
+					...this.option,
 					pagestatus: 3,
 					// orderSn: this.option.orderSn,
-					payDiscountPrice: res.data.discountAmount,
-					...this.option
+					payDiscountPrice: this.payCallData.discountAmount
 				}
 			})
 		},

+ 22 - 12
mobile-code/src/pages/goods/components/sel-popup.vue

@@ -5,21 +5,25 @@
             <div class="tui-popup-box">
 				<div class="tui-product-box">
 					<img :src="imgNormal" class="tui-popup-img" />
-					<div class="tui-popup-price">
-                        <div class="goods-tit app-font-size-30">{{ $util.isEmpty(info.goodsStyleList) ? '' : info.goodsStyleList[selIndex].title }}</div>
-						<div class="tui-amount tui-bold">¥{{ $util.isEmpty(info.goodsStyleList) ? '' : info.goodsStyleList[selIndex].price }}</div>
+					<div class="tui-popup-price" v-if="!$util.isEmpty(info.goodsStyleList)">
+                        <div class="goods-tit app-bold app-font-size-30">{{ info.goodsStyleList[selIndex].styleName }}</div>
+						<div class="tui-amount tui-bold">¥{{ info.goodsStyleList[selIndex].price }}</div>
+					</div>
+					<div class="tui-popup-price" v-else>
+                        <div class="goods-tit app-bold app-font-size-30">{{ info.goodsName }}</div>
+						<div class="tui-amount tui-bold">¥{{ info.price }}</div>
 					</div>
 				</div>
 				<scroll-view scroll-y class="tui-popup-scroll">
 					<div class="tui-scrolldiv-box">
 						<div class="tui-bold tui-attr-title">颜色</div>
 						<div class="tui-attr-box">
-							<div class="tui-attr-item" :class="{'tui-attr-active': selIndex}" v-for="(item, index) in info.goodsStyleList" :key="index">{{ item.title }}</div>
+							<div class="tui-attr-item" :class="{'tui-attr-active': selIndex == index}" v-for="(item, index) in info.goodsStyleList" :key="index" @click="changeStyleFn(index)">{{ item.styleName }}</div>
 						</div>
 
 						<div class="tui-number-box tui-bold tui-attr-title">
 							<div class="tui-attr-title">数量</div>
-							<number-box :max="99" :min="1" :value="buyNum" @change="change"></number-box>
+							<number-box :max="info.stock" :min="1" :value="buyNum" @change="change"></number-box>
 						</div>
 					</div>
 				</scroll-view>
@@ -50,10 +54,10 @@ export default {
 				return {}
 			}
 		},
-		selIndex: {
-			type: Number,
-			default: 0
-		},
+		// selIndex: {
+		// 	type: Number,
+		// 	default: 0
+		// },
 		buyNum: {
 			type: Number,
 			default: 1
@@ -64,12 +68,14 @@ export default {
 		}
 	},
 	data() {
-		return {}
+		return {
+			selIndex: 0
+		}
 	},
 	computed: {
 		imgNormal() {
 			if (!this.$util.isEmpty(this.info)) {
-				return this.info.imgList[0].normal
+				return this.info.smallImgList[0]
 			} else {
 				return ''
 			}
@@ -82,6 +88,9 @@ export default {
 		close() {
 			this.$emit('close')
 		},
+		changeStyleFn(index) {
+			this.selIndex = index
+		},
 		nextFn() {
 			uni.setStorageSync('buyGoodsDetil', this.info)
 			this.$util.pageTo({
@@ -89,7 +98,8 @@ export default {
 				query: {
 					goodsId: this.info.id,
 					goodsStyleId: this.$util.isEmpty(this.info.goodsStyleList) ? '' : this.info.goodsStyleList[this.selIndex].id,
-					goodsNum: this.buyNum
+					goodsNum: this.buyNum,
+					selIndex: this.selIndex
 				}
 			})
 		}

+ 120 - 74
mobile-code/src/pages/goods/detail.vue

@@ -10,7 +10,7 @@
 			</div>
 			<div class="tui-pro-titbox">
 				<div class="tui-pro-title app-size-32">{{ data.goodsName }}</div>
-				<button open-type="share" class="tui-share-btn tui-share-position">
+				<button open-type="share" class="tui-share-btn tui-share-position" @click="shareFn">
 					<app-tag type="gray" tui-tag-class="tui-tag-share tui-size" shape="circleLeft" size="small">
 						<div class="flex-center">
 							<i class="iconfont iconfenxiang"></i>
@@ -54,89 +54,135 @@
 		<buy-foot @buy="showPopup" />
 		<!-- login -->
 		<go-login :show.sync="loginShow" />
+		<!-- 分享 -->
+		<app-share-mask :show="showShare" text="即可分享商品" @click="hideShare" />
 	</div>
 </template>
 
 <script>
-import AppImg from '@/components/app-img'
-import AppSwiper from '@/components/app-swiper'
-import AppTag from '@/components/module/app-tag.vue'
-import AppTrademark from '@/components/module/app-trademark'
-import BuyFoot from './components/buy-foot.vue'
-import SelPopup from './components/sel-popup.vue'
-import GoLogin from '@/pages/home/components/go-login.vue'
-// api
-import { getDetail } from '@/api/goods'
-export default {
-	name: 'goods-detail',
-	components: {
-		AppSwiper,
-		AppTag,
-		AppTrademark,
-		BuyFoot,
-		SelPopup,
-		AppImg,
-		GoLogin
-	},
-	data() {
-		return {
-			data: {},
-			imgList: [],
-			buyNum: 1,
-			popupShow: false,
-			loginShow: false
-		}
-	},
-	onLoad(option) {
-	},
-	mounted() {
-		// this.$util.getCheckLogin().then(res => {
-		// 	if (!res) return false
-		// this.init()
-		// })
-	},
-	computed: {
-		// imgNormal() {
-		// 	if (!this.$util.isEmpty(this.data)) {
-		// 		return this.data.imgList[0]
-		// 	} else {
-		// 		return ''
-		// 	}
-		// }
-	},
-	methods: {
-		init() {
-			this._getDetail()
+	import AppImg from '@/components/app-img'
+	import AppSwiper from '@/components/app-swiper'
+	import AppTag from '@/components/module/app-tag.vue'
+	import AppTrademark from '@/components/module/app-trademark'
+	import BuyFoot from './components/buy-foot.vue'
+	import SelPopup from './components/sel-popup.vue'
+	import GoLogin from '@/pages/home/components/go-login.vue'
+	import AppShareMask from '@/components/module/app-share-mask'
+	import { share } from '@/mixins'
+	// api
+	import { getDetail } from '@/api/goods'
+	export default {
+		name: 'goods-detail',
+		mixins: [share],
+		components: {
+			AppSwiper,
+			AppTag,
+			AppTrademark,
+			BuyFoot,
+			SelPopup,
+			AppImg,
+			GoLogin,
+			AppShareMask
 		},
-		_getDetail() {
-			getDetail({ id: this.option.id }).then(res => {
-				if (this.$util.isEmpty(res.data)) return false
-				this.data = res.data
-				let newArr = []
-				for (let i in res.data.imgList) {
-					newArr.push({
-						img: res.data.imgList[i]
-					})
-				}
-				this.imgList = newArr
-			})
+		data() {
+			return {
+				data: {},
+				imgList: [],
+				buyNum: 1,
+				popupShow: false,
+				loginShow: false,
+				// share
+				showShare: false
+			}
 		},
-		// 更换数量
-		changeNum(e) {
-			this.buyNum = e.value
+		onLoad(option) {},
+		mounted() {
+			// this.$util.getCheckLogin().then(res => {
+			// 	if (!res) return false
+			// this.init()
+			// })
 		},
-		showPopup() {
-			if (this.$util.isLogin()) {
-				this.popupShow = true
-			} else {
-				this.loginShow = true
-			}
+		computed: {
+			// imgNormal() {
+			// 	if (!this.$util.isEmpty(this.data)) {
+			// 		return this.data.imgList[0]
+			// 	} else {
+			// 		return ''
+			// 	}
+			// }
 		},
-		hidePopup() {
-			this.popupShow = false
+		methods: {
+			init() {
+				// #ifdef H5
+				// 微信二次分享
+				let href = window.location.href
+				if (href.indexOf('from=singlemessage') > 0) {
+					location.href = `${this.$constant.formal}/#/pages/interest/invite${this.$util.parse(this.option)}`
+					return false
+				}
+				// #endif
+
+				this._getDetail().then(() => {
+					// 设置分享
+					let shareParams = {
+						title: `${this.data.goodsName}`, // 分享标题
+						desc: '这束花不错推荐给你', // 分享内容
+						imgUrl: this.data.smallImgList[0],
+						// #ifdef H5
+						pagePath: `${window.location.protocol}//m.${this.$constant.firstHost}.com/#/pages/goods/detail?id=${this.data.id}`,
+						// #endif
+						// #ifndef H5
+						pagePath: `/pages/goods/detail?id=${this.data.id}`
+						// #endif
+					}
+					this.jweixinFn(shareParams)
+				})
+			},
+			async _getDetail() {
+				await getDetail({ id: this.option.id }).then(res => {
+					if (this.$util.isEmpty(res.data)) return false
+					let newArr = []
+					for (let i in res.data.imgList) {
+						newArr.push({
+							img: res.data.imgList[i]
+						})
+					}
+					this.imgList = newArr
+					// 格式化数据
+					let goodsStyleList = []
+					for (let i in res.data.goodsStyleList) {
+						goodsStyleList.push(res.data.goodsStyleList[i])
+					}
+					res.data.stock = res.data.stock ? parseInt(res.data.stock) : 0
+					res.data.goodsStyleList = goodsStyleList
+					
+					this.data = res.data
+				})
+			},
+			// 更换数量
+			changeNum(e) {
+				this.buyNum = e.value
+			},
+			showPopup() {
+				if (this.$util.isLogin()) {
+					this.popupShow = true
+				} else {
+					this.loginShow = true
+				}
+			},
+			hidePopup() {
+				this.popupShow = false
+			},
+			// 分享
+			shareFn() {
+				console.log('asdfasdf')
+				this.showShare = true
+			},
+			hideShare() {
+				this.showShare = false
+			}
 		}
 	}
-}
 </script>
 
 <style lang="scss" scoped>

+ 20 - 4
mobile-code/src/pages/order/buy.vue

@@ -27,6 +27,13 @@
 				<div class="module-tit">商品金额</div>
 				<div class="module-det">
 					<app-list-module v-if="!$util.isEmpty(goodsInfo)" :info="goodsInfo" />
+					<div class="shop-prompt">
+						<div>
+							<span>运费(6公里)</span>
+							<i class="iconfont iconchangjianwentixiangguanwenti2"></i>
+						</div>
+						<div>¥{{ goodsInfo.price }}</div>
+					</div>
 					<div class="shop-prompt">
 						<div>总计</div>
 						<div>¥{{ goodsInfo.price * option.goodsNum }}</div>
@@ -139,9 +146,11 @@
 			// 计算总金额
 			totalPrice() {
 				let totalPrice = this.goodsInfo.price * this.option.goodsNum
-				let discountMember = this.$util.isEmpty(this.shopUser) ? this.shopUser.userAsset.discount * totalPrice : 1 * totalPrice
-				discountMember = discountMember / 10
-				return discountMember.toFixed(2)
+				console.log('this.shopUser', this.shopUser)
+				// let discountMember = this.$util.isEmpty(this.shopUser) ? this.shopUser.userAsset.discount * totalPrice : 1 * totalPrice
+				// discountMember = discountMember / 10
+				// return discountMember.toFixed(2)
+				return totalPrice.toFixed(2)
 			}
 		},
 		onLoad(option) {
@@ -150,6 +159,7 @@
 		methods: {
 			init() {
 				let goodsInfo = uni.getStorageSync('buyGoodsDetil')
+				goodsInfo.price = this.option.goodsStyleId ? goodsInfo.goodsStyleList[this.option.selIndex].price : goodsInfo.price
 				// if (this.$util.isEmpty(goodsInfo)) {
 				// 	this.$util.pageTo({
 				// 		url: `/pages/goods/detail`,
@@ -274,11 +284,17 @@
 		}
 		// 商品金额
 		.shop-price-wrap {
+			.module-det {
+				padding-bottom: 20px;
+			}
 			.shop-prompt {
 				@include disFlex(center, space-between);
 				color: $fontColor2;
 				margin-top: 20px;
-				padding-bottom: 20px;
+				.iconchangjianwentixiangguanwenti2 {
+					color: #ccc;
+					margin-left: 10px;
+				}
 			}
 		}
 		// 可选优惠

+ 15 - 0
mobile-code/src/plugins/luch-request_0.0.7/request.js

@@ -163,6 +163,21 @@ class Request {
 								// 	url: `/pages/page/login/index`
 								// })
 							}, 1000)
+						} else if (response.data.code == 2) {
+							uni.removeStorageSync('token')
+							uni.removeStorageSync('shopUser')
+							uni.removeStorageSync('account')
+							uni.showToast({
+								title: '登录失效,正在重新登录...',
+								icon: 'none',
+								mask: true
+							})
+							setTimeout(() => {
+								getCheckLogin()
+								// uni.reLaunch({
+								// 	url: `/pages/page/login/index`
+								// })
+							}, 1000)
 						} else {
 							console.log('response.data', response.data)
 							if (!config.hideError) {