lhl před 2 roky
rodič
revize
612cd75aec

+ 9 - 0
api/shop.js

@@ -69,4 +69,13 @@ export function gozz(data) {
 		method: 'post',
 		data
 	})
+}
+
+// 发布优惠券
+export function storeCoupon(data) {
+	return request({
+		url: '/api/store_coupon',
+		method: 'post',
+		data
+	})
 }

+ 7 - 0
pages.json

@@ -67,6 +67,13 @@
 
 			}
 		},
+		{
+			"path": "pages/shop/createYhq",
+			"style": {
+				"navigationBarTitleText": "添加优惠券"
+		
+			}
+		},
 		{
 			"path": "pages/public/register",
 			"style": {

+ 1 - 0
pages/order/order.vue

@@ -275,6 +275,7 @@
 					obj.$api.showOk('赠送成功')
 				}).catch(err => {
 					obj.dhing = false
+					
 				})
 			},
 			sy(e) {

+ 205 - 0
pages/shop/createYhq.vue

@@ -0,0 +1,205 @@
+<template>
+	<view class="content">
+		<view class="jg"></view>
+		<view class="tab">
+			<view class="tab-item flex">
+				<view class="item-name">名称</view>
+				<input type="text" placeholder="请输入优惠券名称" class="item-val" v-model="name">
+			</view>
+			<view class="tab-item flex">
+				<view class="item-name">介绍</view>
+				<textarea name="" id="" cols="30" rows="10" placeholder="请输入优惠券介绍" v-model="store_info"
+					class="item-area"></textarea>
+			</view>
+			<view class="tab-item flex">
+				<view class="item-name">价格</view>
+				<input type="number" placeholder="请输入优惠券价格" class="item-val" v-model="price">
+			</view>
+			<view class="tab-item flex">
+				<view class="item-name">原价</view>
+				<input type="number" placeholder="请输入优惠券原价" class="item-val" v-model="ot_price">
+			</view>
+			<view class="tab-item flex">
+				<view class="item-name">面值</view>
+				<input type="number" placeholder="请输入优惠券面值" class="item-val" v-model="coupon_price">
+			</view>
+			<view class="tab-item flex">
+				<view class="item-name">开始时间</view>
+				<picker mode="date" class="item-val" @change="bindStartTimeChange">
+					<view class="item-val" :class="{'empty': start_time == ''}">
+						{{start_time == ''?'请输入优惠券开始时间':start_time}}
+					</view>
+				</picker>
+				<!-- <input type="number" placeholder="请输入优惠券开始时间" class="item-val" v-model="start_time"> -->
+			</view>
+			<view class="tab-item flex">
+				<view class="item-name">结束时间</view>
+				<picker mode="date" class="item-val" @change="bindEndTimeChange">
+					<view class="item-val" :class="{'empty': end_time == ''}">{{end_time == ''?'请输入优惠券结束时间':end_time}}
+					</view>
+				</picker>
+				<!-- <input type="number" placeholder="请输入优惠券结束时间" class="item-val" v-model="end_time"> -->
+			</view>
+			<view class="tab-item flex">
+				<view class="item-name">发放数量</view>
+				<input type="number" placeholder="请输入优惠券发放数量" class="item-val" v-model="stock">
+			</view>
+		</view>
+		<view class="sub" @click="sub">
+			确认添加
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		storeCoupon
+	} from '@/api/shop.js'
+	export default {
+		data() {
+			return {
+				name: '',
+				price: '',
+				ot_price: '',
+				coupon_price: '',
+				start_time: '',
+				end_time: '',
+				stock: '',
+				store_info: '',
+				uping: false,
+			}
+		},
+		onLoad() {
+
+		},
+		onShow() {
+
+		},
+		onReachBottom() {
+
+		},
+		onReady() {
+
+		},
+		methods: {
+			bindStartTimeChange(res) {
+				console.log(res)
+				this.start_time = res.detail.value
+			},
+			bindEndTimeChange(res) {
+				console.log(res)
+				this.end_time = res.detail.value
+			},
+			sub() {
+				console.log('dddd')
+				let obj = this
+				if (obj.uping) {
+					return
+				}
+				if (obj.name == '') {
+					return obj.$api.msg('请输入优惠券名称')
+				}
+				if (obj.store_info == '') {
+					return obj.$api.msg('请输入优惠券介绍')
+				}
+				if (obj.price == '') {
+					return obj.$api.msg('请输入优惠券价格')
+				}
+				if (obj.ot_price == '') {
+					return obj.$api.msg('请输入优惠券原价')
+				}
+				if (obj.coupon_price == '') {
+					return obj.$api.msg('请输入优惠券面值')
+				}
+				if (obj.start_time == '') {
+					return obj.$api.msg('请输入优惠券开始时间')
+				}
+				if (obj.end_time == '') {
+					return obj.$api.msg('请输入优惠券结束时间')
+				}
+				if (obj.stock == '') {
+					return obj.$api.msg('请输入优惠券发放数量')
+				}
+				obj.uping = true
+				storeCoupon({
+					name: obj.name,
+					price: obj.price,
+					ot_price: obj.ot_price,
+					coupon_price: obj.coupon_price,
+					start_time: obj.start_time,
+					end_time: obj.end_time,
+					stock: obj.stock,
+					store_info: obj.store_info,
+				}).then(res => {
+					obj.$api.showOk('添加成功')
+					obj.uping = false
+				}).catch(res => {
+					obj.uping = false
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.jg {
+		height: 20rpx;
+	}
+
+	.tab {
+		width: 690rpx;
+		margin: auto;
+		border-radius: 10px;
+		background-color: #fff;
+		margin-bottom: 20rpx;
+
+		.tab-item {
+			padding: 0 20rpx;
+			font-size: 30rpx;
+			align-items: flex-start;
+			line-height: 100rpx;
+			border-bottom: 1px #F0F0F0 solid;
+
+			&:last-of-type {
+				border-bottom: none;
+			}
+
+			.item-name {
+				flex-shrink: 0;
+				width: 220rpx;
+				color: #333333;
+			}
+
+			.item-area {
+				// padding-top: 28rpx;
+				border: 1px #F0F0F0 solid;
+				margin: 28rpx 0;
+				border-radius: 20rpx;
+			}
+
+			.item-val {
+				display: inline-block;
+				flex-grow: 1;
+				text-align: left;
+				line-height: 100rpx;
+				height: 100rpx;
+			}
+		}
+	}
+
+	.sub {
+		text-align: center;
+		width: 560rpx;
+		line-height: 80rpx;
+		background: #ff005d;
+		border-radius: 40rpx;
+		color: #fff;
+		font-size: 30rpx;
+		font-weight: 500;
+		margin: 80rpx auto 0;
+	}
+
+	.empty {
+		color: #999999;
+	}
+</style>

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
unpackage/dist/build/mp-weixin/pages/order/order.js


+ 1 - 2
unpackage/dist/build/mp-weixin/project.config.json

@@ -31,8 +31,7 @@
             "outputPath": ""
         },
         "disableUseStrict": false,
-        "useCompilerPlugins": false,
-        "minifyWXML": true
+        "useCompilerPlugins": false
     },
     "compileType": "miniprogram",
     "libVersion": "2.24.4",

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů