Kaynağa Gözat

套餐内优惠券分享修改

huangzhe 3 yıl önce
ebeveyn
işleme
177ed3925f

+ 0 - 1
src/core/request.js

xqd
@@ -45,7 +45,6 @@ const request = async function (args) {
         data: args.data,
         header: header
     });
-	console.log('request',error,response)
     if (error) {
         let msg = {
             code: 400,

+ 1 - 1
src/pages.json

xqd
@@ -1596,7 +1596,7 @@
 				{
 					"path": "detail/detail",
 					"style": {
-						"navigationBarTitleText": ""
+						"navigationBarTitleText": "套餐内商品"
 					}
 				}
 			]

+ 8 - 5
src/pages/case/components/hxj-bd-info.vue

xqd xqd xqd xqd xqd
@@ -12,10 +12,12 @@
 					<view class="hjx-text-decoration-line-through">{{originalPrice}}元</view>
 				</view>
 				<view class="hjx-tc-AE8445 hjx-ts-22 hjx-tw-500" style="margin:26rpx 0 22rpx ;">券后价</view>
-				<view class="hxj-price"><text class="rmb">¥</text>{{price}}<text class="dw">元</text></view>
+				<view class="hxj-price"><text class="rmb">¥</text>{{discount_amount}}<text class="dw">元</text></view>
 			</view>
 			<view class="main-between-y">
-				<view class="main-center cross-center lq" @click="receive">领券<image src="../../../static/image/index/arrow-right-facet-white.png" mode=""></image></view>
+				<view>
+					<view v-if="coupons.length>0" class="main-center cross-center lq" @click="receive">领券<image src="../../../static/image/index/arrow-right-facet-white.png" mode=""></image></view>
+				</view>
 				<view class="cross-center se" v-if="isShowShare" @click="shareClick">
 					<image src="https://t17.9026.com/web/statics/image/index/share_y.png" mode=""></image>分享
 				</view>
@@ -31,7 +33,7 @@
 			<bd-quick-share v-model="quickShareShow" @quickShare="quickShare" :goods-id="goodsId"
 				:is-video-number="goods.is_video_number" :extra-quick-share="extraQuickShare"
 				:app-share-pic="appSharePic" :app-share-title="appShareTitle"></bd-quick-share>
-			<app-share-qr-code @share="testShare" v-model="shareShow" :url="newShareUrl" :goods="goods"
+			<app-share-qr-code @share="testShare" v-model="shareShow" :url="newShareUrl" 
 				:poster-config="posterConfig" :poster-generate="posterGenerate" :has-poster-nav="hasPosterNav"
 				:app-share-pic="appSharePic" :app-share-title="appShareTitle"></app-share-qr-code>
 		</template>
@@ -50,7 +52,7 @@
 		props: {
 			name: String,
 			theme: Object,
-			price: {
+			discount_amount: {
 				type: [Number, String]
 			},
 			originalPrice: {
@@ -59,6 +61,7 @@
 			sales: {
 				type: [Number, String]
 			},
+			coupons:Array,
 			tag:String,
 			goodsId: Number,
 			goods: Object,
@@ -109,7 +112,7 @@
 					return this.shareUrl;
 				} else {
 					if (this.goodsId) {
-						return this.$api.poster.goods + '&goods_id=' + this.goodsId;
+						return this.$api.poster.goods + '&composition_id=' + this.goodsId;
 					} else {
 						return ``;
 					}

+ 68 - 54
src/pages/case/projectInfo.vue

xqd xqd xqd xqd
@@ -19,12 +19,12 @@
 					</view>
 				</view>
 				<hxj-scroll-list :itemWidth="'168rpx'" :itemHeight="'168rpx'" :list="list"></hxj-scroll-list>
-				<hxj-bd-info :theme="getTheme" :name="compositionList.name" :price="compositionList.price" :original-price="compositionList.price"
-					:sales="Number(compositionList.sale_num)+Number(compositionList.virtual_sale_num)" :tag="compositionList.tag" :measure="compositionList.measure" :house_layout="compositionList.exampleHouse.name" :goods-id="compositionList.id" :extra-quick-share="extra_quick_share"
+				<hxj-bd-info :theme="getTheme" :name="compositionList.name" :discount_amount="compositionList.discount_amount" :original-price="compositionList.price"
+					:sales="Number(compositionList.sale_num)+Number(compositionList.virtual_sale_num)" :tag="compositionList.tag" :measure="compositionList.measure" :house_layout="compositionList.exampleHouse.name" :goods-id="compositionList.id" :coupons="goods_coupon_center" :extra-quick-share="extra_quick_share"
 					:app-share-pic="app_share_pic ? app_share_pic : goods.pic_url[0].pic_url"
 					:app-share-title="compositionList.name"
-					:poster-config="poster_config + `&goods_id=` + compositionList.id"
-					:poster-generate="poster_generate + `&goods_id=` + compositionList.id" :has-poster-nav="true" :goods="goods"
+					:poster-config="poster_config + `&composition_id=` + compositionList.id"
+					:poster-generate="poster_generate + `&composition_id=` + compositionList.id" :has-poster-nav="true" :goods="goods"
 					@share="hShareAppMessage" @quickShare="quickShare" @receive="receive">
 				</hxj-bd-info>
 				<view class="hxj-goods-list" :style="{ height: isOpen ? 'auto' : '270rpx' }">
@@ -246,57 +246,57 @@
 				sendPath: '',
 				poster_config: this.$api.goods.poster,
 				poster_generate: this.$api.poster.goods_new,
-				// 限时抢购
-				flash_sale: null,
-				checked: null,
-				// 商品服务
-				services: null,
-				// 商品详情
-				detail: null,
-				// 商品ID
-				goodsId: null,
-				// 套餐组合
-				composition: null,
-				autoplay: true,
-				full_reduce: null,
-				goods_marketing_award: null,
-				express: null,
-				goods_marketing: null,
-				exchangeStatus: null,
-				exchange: null,
+				// // 限时抢购
+				// flash_sale: null,
+				// checked: null,
+				// // 商品服务
+				// services: null,
+				// // 商品详情
+				// detail: null,
+				// // 商品ID
+				// goodsId: null,
+				// // 套餐组合
+				// composition: null,
+				// autoplay: true,
+				// full_reduce: null,
+				// goods_marketing_award: null,
+				// express: null,
+				// goods_marketing: null,
+				// exchangeStatus: null,
+				// exchange: null,
 
-				price: null,
-				level_show: null,
-				sales: null,
-				unit: null,
-				is_sales: null,
-				extra_quick_share: null,
-				price_max: null,
-				price_min: null,
-				price_member_max: null,
-				price_member_min: null,
-				original_price: null,
-				subtitle: null,
-				is_negotiable: null,
-				name: null,
-				app_share_pic: null,
-				app_share_title: null,
-				goodsType: null,
-				favorite: null,
+				// price: null,
+				// level_show: null,
+				// sales: null,
+				// unit: null,
+				// is_sales: null,
+				// extra_quick_share: null,
+				// price_max: null,
+				// price_min: null,
+				// price_member_max: null,
+				// price_member_min: null,
+				// original_price: null,
+				// subtitle: null,
+				// is_negotiable: null,
+				// name: null,
+				// app_share_pic: null,
+				// app_share_title: null,
+				// goodsType: null,
+				// favorite: null,
 				goods_coupon_center: null,
-				guarantee_title: null,
-				guarantee_pic: null,
-				param_content: null,
-				param_name: null,
-				attr_groups: null,
-				goods_num: null,
-				good_stock: null,
-				min_number: null,
-				limit_buy: null,
-				disable: 'disable',
-				sell_time: 0,
-				template_message_list: [],
-				is_finish_sell: false
+				// guarantee_title: null,
+				// guarantee_pic: null,
+				// param_content: null,
+				// param_name: null,
+				// attr_groups: null,
+				// goods_num: null,
+				// good_stock: null,
+				// min_number: null,
+				// limit_buy: null,
+				// disable: 'disable',
+				// sell_time: 0,
+				// template_message_list: [],
+				// is_finish_sell: false
 			};
 		},
 		computed: {
@@ -516,6 +516,7 @@
 				});
 			},
 			loadData(id, options) {
+				this.$showLoading();
 				this.$request({
 					url: this.$api.composition.info,
 					data: {
@@ -533,13 +534,26 @@
 							this.list.push({image,link:`/pages/goods/goods?id=${id}`,name,goods_num})
 						}
 					}
+					this.$hideLoading();
+				})
+				this.$request({
+					url: this.$api.coupon.list,
+					data: {
+						composition_id: id,
+						limit:100,
+					},
+					method: 'get'
+				}).then(res => {
+					if(res.code===0){
+						this.goods_coupon_center=res.data.list
+					}
 				})
 				// return new Promise((resolve, reject) => {
 				// 	this.$showLoading();
 				// 	this.$request({
 				// 			url: this.$api.goods.detail,
 				// 			data: {
-				// 				id: id,
+				// 				id: 18,
 				// 				plugin: options && options.exchange ? 'exchange' : 'mall'
 				// 			}
 				// 		})

+ 5 - 2
src/pages/goods/goods.vue

xqd xqd xqd
@@ -78,7 +78,7 @@
                 :pickup="goods_marketing.pickup"
             ></bd-kb>
             <!--套餐组合-->
-            <view @click="toComposition" class="goods-composition" v-if="composition && composition.list.length > 0">
+            <view  class="goods-composition" v-if="composition && composition.list.length > 0">
                 <view class="goods-composition-title">套餐组合</view>
                 <uni-swiper-dot :current="current" :theme="getTheme" :info="composition.list" mode="customize">
                     <swiper @change="change" class="goods-composition-swiper" :current="current" :autoplay="true">
@@ -87,10 +87,12 @@
                         </swiper-item>
                     </swiper>
                 </uni-swiper-dot>
+				<navigator url="/pages/case/hot_sale_project" hover-class="none">
                 <view class="goods-composition-more main-between cross-center">
                     <view>更多套餐组合</view>
                     <image src="https://shop.9026.com/web/statics/image/mall/static/icon/arrow-right.png"></image>
                 </view>
+				</navigator>
             </view>
             <bd-comments :goods-id="goodsId"></bd-comments>
             <!--商品详情-->
@@ -528,7 +530,8 @@
             toComposition(item) {
                 let id = item.id > 0 ? item.id : this.composition.list[0].id
                 uni.navigateTo({
-                    url: this.composition.url + '?goods_id=' + this.goodsId + '&composition_id=' + id
+                    // url: this.composition.url + '?goods_id=' + this.goodsId + '&composition_id=' + id
+					url: '/pages/case/projectInfo?id='+ id
                 })
             },
             loadData(id, options) {

+ 1 - 1
src/plugins/composition/components/app-add-subtract/app-add-subtract.vue

xqd
@@ -46,7 +46,7 @@
 				}
 			}, 
 			value: {
-				type: [String, Number],
+				type: Number,
 				default () {
 					return 1;
 				}

+ 8 - 7
src/plugins/composition/components/app-bd-info/app-bd-info.vue

xqd xqd xqd
@@ -2,20 +2,20 @@
 	<view>
 		<view class="main-between info-box">
 			<view class="main-left">
-				<image class="gd-cover" src="https://swdzshopv4.oss-cn-chengdu.aliyuncs.com/uploads/mall10000/20211213/bea32f790435d8a108717fd823113cda.jpg" mode=""></image>
+				<image class="gd-cover" :src="info.cover_img" mode=""></image>
 				<view>
-					<view class="title">{{name}}</view>
+					<view class="title">{{info.name}}</view>
 					<view>
 						<text class="price">
 							<text class="dw">¥</text>
-							<text class="rmb">2466</text>
+							<text class="rmb">{{total}}</text>
 							<text class="decimal">.00</text>
 						</text>
 						<text class="price-line"><text>¥</text>3000.00</text>
 					</view>
 					<view class="main-between">
 						<view class="main-left">
-							<view class="tag">套餐</view>
+							<view class="tag">{{info.tag}}</view>
 							<view class="tag">全款</view>
 							<view class="tag">满200减10</view>
 						</view>
@@ -23,7 +23,7 @@
 				</view>
 			</view>
 			<view class="cross-bottom">
-				<view class="main-center cross-center receive" @click="receive">
+				<view class="main-center cross-center receive" @click="receive" v-if="coupons.length>0">
 					领券<image src="../../../../static/image/index/arrow-right-facet-white.png" mode=""></image>
 				</view>
 			</view>
@@ -34,8 +34,9 @@
 <script>
 	export default {
 		props:{
-			name:String,
-			max
+			info:Object,
+			coupons:Array,
+			total:Number,
 		},
 		data() {
 			return {

+ 13 - 22
src/plugins/composition/components/app-list/app-list.vue

xqd xqd xqd xqd
@@ -2,18 +2,9 @@
     <view>
         <view class="app-list" :style="{'margin-top': `${top}rpx`}">
             <view class="app-item" v-for="(item,index) in list" :key="item.id">
-                <!-- <view class="dir-left-nowrap cross-center app-item-title">
-                    <view class="check-icon" @click="choose(index,item)">
-                        <image src="https://shop.9026.com/web/statics/image/mall/static/icon/icon-uncheck.png" v-if="!item.choose"></image>
-                        <image :style="{'background-color': theme.background,'opacity': `${item.type == 1 ? '0.3' : '1'}`}"  src="https://shop.9026.com/web/statics/image/mall/static/icon/icon-checkbox-checked.png" v-else></image>
-                    </view>
-                    <view :style="{'color': theme.color}" class="item-type">{{item.type_text}}</view>
-                    <view class="item-name">{{item.name}}</view>
-                </view> -->
-                <view class="item-goods main-between" v-for="goods in item.host_list" :key="goods.id">
-                   <!-- <view class="check-icon">
-                        <image :style="{'background-color': theme.background,'opacity': `${goods.opacity}`}" src="https://shop.9026.com/web/statics/image/mall/static/icon/icon-checkbox-checked.png"></image>
-                    </view> -->
+                
+                <view class="item-goods main-between" v-for="(goods,index1) in item.host_list" :key="goods.id">
+                   
                     <view class="main-left">
 						<image @click="toDetail(goods.goods_id)" class="goods-img" :src="goods.cover_pic"></image>
 						<view v-if="goods.stock == 0 || item.stock == 0" class="out-dialog">
@@ -33,17 +24,12 @@
 						        </view>
 						        <image class="item-good-attr-arrow" src="https://t17.9026.com/web/statics/image/index/arrow-right-A18353.png"></image>
 						    </view>
-						    <!-- <view v-if="item.type == 2 && goods.choose_attr" :style="{'color': theme.color}" class="choose_price">¥{{goods.total_price}}</view> -->
-							<view class="price"><text class="ought_price">¥3400.00</text><text class="paid_price">实付:¥<text>{{goods.total_price}}</text></text></view>
+							<view class="price"><text class="ought_price">¥{{goods.max_price}}</text><text class="paid_price" v-show="goods.total_price">实付:¥<text>{{goods.total_price}}</text></text></view>
 						</view>
 					</view>
-					<app-add-subtract :xStyle="2" :stock="100"></app-add-subtract>
+					<app-add-subtract :xStyle="2" :stock="goods.stock" :good_id="goods.id" :value="goods.choose_attr.number" @change="addsubChange($event,goods,index,index1)"></app-add-subtract>
                 </view>                    
                 <view class="item-goods main-between" v-for="(goods,idx) in item.goods_list" :key="goods.id">
-                    <!-- <view class="check-icon" v-if="item.type == 2" @click="chooseGoods(idx,index,goods)">
-                        <image src="https://shop.9026.com/web/statics/image/mall/static/icon/icon-uncheck.png" v-if="!goods.choose_goods"></image>
-                        <image :style="{'background-color': theme.background}" src="https://shop.9026.com/web/statics/image/mall/static/icon/icon-checkbox-checked.png" v-else></image>
-                    </view> -->
 					<view class="main-left">
                     <image @click="toDetail(goods.goods_id)" class="goods-img" :src="goods.cover_pic"></image>
                     <view v-if="goods.stock == 0 || item.stock == 0" class="out-dialog">
@@ -65,11 +51,10 @@
                             </view>
                             <image class="item-good-attr-arrow" src="https://t17.9026.com/web/statics/image/index/arrow-right-A18353.png"></image>
                         </view>
-                        <!-- <view v-if="item.type == 2 && goods.choose_attr"  :style="{'color': theme.color}" class="choose_price">¥{{goods.total_price}}</view> -->
-						<view class="price"><text class="ought_price">¥3400.00</text><text class="paid_price">实付:¥<text>{{goods.total_price}}</text></text></view>
+                        <view class="price"><text class="ought_price">¥{{goods.max_price}}</text><text class="paid_price" v-show="goods.total_price">实付:¥<text>{{goods.total_price}}</text></text></view>
                     </view>
 					</view>
-					<app-add-subtract :xStyle="2" :stock="100"></app-add-subtract>
+					<app-add-subtract :xStyle="2" :stock="goods.stock" :good_id="goods.id" :value="goods.choose_attr.number" @change="addsubChange($event,goods,index,idx)"></app-add-subtract>
                 </view>
                 <view class="app-price">
                     <template v-if="item.total_price && hidden">
@@ -167,6 +152,12 @@
 			appAddSubtract
         },
         methods: {
+			addsubChange(e,goods,index,index1){
+				console.log('数量',e,goods)
+				this.list[index].host_list[index1].choose_attr.number=e.number
+				
+				this.$emit("updateList",this.list);
+			},
             // 规格选择
             check({item}) {
                 this.checked = item;

+ 32 - 38
src/plugins/composition/detail/detail.vue

xqd xqd xqd xqd
@@ -1,6 +1,6 @@
 <template>
 	<app-layout>
-		<app-bd-info @receive="receive" :name="list[0].name"></app-bd-info>
+		<app-bd-info @receive="receive" :info="list[0]" :coupons="goods_coupon_center" :total="total"></app-bd-info>
 		<!--商品优惠券-->
 		<bd-coupon @change="setCoupon" @on-show-change="val => {isCouponShow = val}" :isCustomEntry="true"
 			:myShow="isCouponShow" :theme="getTheme" :coupons="goods_coupon_center"></bd-coupon>
@@ -77,29 +77,7 @@
 
 
 				isCouponShow: false,
-				goods_coupon_center: [
-					// {
-					// 	appoint_type: "3",
-					// 	begin_time: "0000-00-00 00:00:00",
-					// 	can_receive_count: "-1",
-					// 	cat: [],
-					// 	desc: "",
-					// 	discount: 10,
-					// 	discount_limit: 0,
-					// 	end_time: "0000-00-00 00:00:00",
-					// 	expire_day: "99",
-					// 	expire_type: "1",
-					// 	goods: [],
-					// 	id: "2",
-					// 	is_receive: "0",
-					// 	min_price: 100,
-					// 	name: "优惠券1",
-					// 	rule: "",
-					// 	share_type: 4,
-					// 	sub_price: 10,
-					// 	type: "2",
-					// }
-				]
+				goods_coupon_center: []
 			}
 		},
 		components: {
@@ -316,24 +294,27 @@
 							for (let idx in that.list[i].goods_list) {
 								that.list[i].goods_list[idx].choose_attr = null;
 								if (that.list[i].goods_list[idx].goods_attr.length == 1) {
-									that.list[i].goods_list[idx].choose_attr = that.list[i].goods_list[idx]
-										.goods_attr[0];
-									that.list[i].goods_list[idx].choose_attr.number = 1;
-									that.list[i].goods_list[idx].total_price = (+that.list[i].goods_list[idx]
-										.choose_attr.price - +that.list[i].goods_list[idx].price).toFixed(2)
+									// that.list[i].goods_list[idx].choose_attr = that.list[i].goods_list[idx]
+									// 	.goods_attr[0];
+									// that.list[i].goods_list[idx].choose_attr.number = 1;
+									// that.list[i].goods_list[idx].total_price = (+that.list[i].goods_list[idx]
+									// 	.choose_attr.price - +that.list[i].goods_list[idx].price).toFixed(2)
 								}
 								if (that.list[i].type == 2) {
-									that.list[i].host_list[0].choose_attr = null;
-									if (that.list[i].host_list[0].goods_attr.length == 1) {
-										that.list[i].host_list[0].choose_attr = that.list[i].host_list[0]
-											.goods_attr[0];
-										that.list[i].host_list[0].choose_attr.number = 1;
-										that.list[i].host_list[0].total_price = (+that.list[i].host_list[0]
-											.choose_attr.price - +that.list[i].host_list[0].price).toFixed(2)
+									for (let t = 0; t < that.list[i].host_list.length; t++) {
+										that.list[i].host_list[t].choose_attr = null;
+										if (that.list[i].host_list[t].goods_attr.length == 1) {
+											that.list[i].host_list[t].choose_attr = that.list[i].host_list[t].goods_attr[0];
+											that.list[i].host_list[t].choose_attr.number = 1;
+											that.list[i].host_list[t].total_price = (+that.list[i].host_list[t]
+												.choose_attr.price - +that.list[i].host_list[t].price).toFixed(2)
+										}
+										that.list[i].host_list[t].choose_goods = true;
+										that.list[i].host_list[t].opacity = 0.3;
 									}
+									
 									that.list[i].goods_list[idx].choose_goods = false;
-									that.list[i].host_list[0].choose_goods = true;
-									that.list[i].host_list[0].opacity = 0.3;
+									
 								}
 							}
 						}
@@ -354,6 +335,19 @@
 					uni.hideLoading();
 					that.$hideLoading();
 				});
+				
+				this.$request({
+					url: this.$api.coupon.list,
+					data: {
+						composition_id: this.composition_id,
+						limit:100,
+					},
+					method: 'get'
+				}).then(res => {
+					if(res.code===0){
+						this.goods_coupon_center=res.data.list
+					}
+				})
 			},
 			getMore() {
 				let that = this;