<template>
	<view class="container">
		<form @submit="onSubmit">
			<view class="page-block">
				<view class="red">
					Tips:微信的请先添加对应的类目：餐饮 > 餐饮服务场所/餐饮服务管理企业
				</view>
				<view class="content">
					<view class="cell">
						<view class="title-block required">
							<text>微信下单加积分</text>
						</view>
						<view class="desc">
							<input type="text" :value="info.jf_tid" name="jf_tid" class="input-box" placeholder="请输入"
								placeholder-class="desc-placeholder">
						</view>
					</view>
					<view class="cell ">
						<view class="title-block required">
							<text>微信支付成功</text>
						</view>
						<view class="desc">
							<input type="text" :value="info.pay_tid" name="pay_tid" class="input-box" placeholder="请输入"
								placeholder-class="desc-placeholder">
						</view>
					</view>


					<view class="cell ">
						<view class="title-block required">
							<text>微信余额变更</text>
						</view>
						<view class="desc">
							<input type="text" :value="info.balance_tid" name="balance_tid" class="input-box" placeholder="请输入"
								placeholder-class="desc-placeholder">
						</view>
					</view>


					<view class="cell ">
						<view class="title-block required">
							<text>卡券到账通知</text>
						</view>
						<view class="desc">
							<input type="text" :value="info.card_tid" name="card_tid" class="input-box" placeholder="请输入"
								placeholder-class="desc-placeholder">
						</view>
					</view>


					<view class="cell ">
						<view class="title-block required">
							<text>会员开通成功通知</text>
						</view>
						<view class="desc">
							<input type="text" :value="info.member_tid" name="member_tid" class="input-box" placeholder="请输入"
								placeholder-class="desc-placeholder">
						</view>
					</view>

					<!-- <view class="cell ">
						<view class="title-block required">
							<text>支付宝支付成功通知</text>
						</view>

						<view class="desc">
							<input type="text" :value="info.alipay_pay_tid" name="alipay_pay_tid" class="input-box"
								placeholder="请输入" placeholder-class="desc-placeholder">
						</view>
					</view>

					<view class="cell ">
						<view class="title-block required">
							<text>支付宝积分订阅消息提醒</text>
						</view>

						<view class="desc">
							<input type="text" :value="info.alipay_integral" name="alipay_integral" class="input-box"
								placeholder="请输入" placeholder-class="desc-placeholder">
						</view>
					</view>

					<view class="cell ">
						<view class="title-block required">
							<text>支付宝余额订阅消息提醒</text>
						</view>
						<view class="desc">
							<input type="text" :value="info.alipay_balance" name="alipay_balance" class="input-box"
								placeholder="请输入" placeholder-class="desc-placeholder">
						</view>
					</view> -->

			<!-- 		<view class="cell ">
						<view class="title-block required">
							<text>支付宝卡券到账通知</text>
						</view>
						<view class="desc">
							<input type="text" :value="info.alipay_coupons" name="alipay_coupons" class="input-box"
								placeholder="请输入" placeholder-class="desc-placeholder">
						</view>
					</view> -->

					<view class="cell ">
						<view class="title-block required">
							<text>支付宝会员开通成功提醒</text>
						</view>
						<view class="desc">
							<input type="text" :value="info.alipay_user" name="alipay_user" class="input-box"
								placeholder="请输入" placeholder-class="desc-placeholder">
						</view>
					</view>
				</view>
			</view>
			<view style="height: 150rpx;"></view>
			<button class="sub-btn" hover-class="none" form-type="submit">
				立即提交
			</button>
		</form>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {},
			}
		},

		onLoad() {
			this.getdata();
		},
		methods: {
			getdata(e) {
				this.request({
					url: "Smdcshop/store_template_info",
					data: {
						admin_id: uni.getStorageSync("admin_id")
					},
				}).then(res => {
					console.log(res, "res")
					if (res.code === '200') {
						this.info = res.data;
					}
				});
			},

			onSubmit(e) {
				let data = e.detail.value;
				data.admin_id = uni.getStorageSync("admin_id");
				data.id = this.info.id;
				uni.showModal({
					title: '提示',
					content: '是否要修改？',
					showCancel: true,
					cancelText: '取消',
					confirmText: '确定',
					success: r => {
						if (r.confirm) {

							this.request({
								url: "Smdcshop/store_template_update",
								data: data,
							}).then(res => {
								if (res.code == 200) {
									uni.showToast({
										title: res.message,
										icon: 'none'
									})
									setTimeout(() => {
										uni.navigateBack()
									}, 2000)
								}
							}).catch((res) => {
								uni.showToast({
									title: res.message,
									icon: 'none'
								})
							});

						}
					}

				});

			}

		}
	}
</script>

<style>
	@import url("../static/css/common.css");

	page {
		background-color: #F4F5F7;
	}

	.title-block {
		padding-top: 20rpx;
	}

	.red {
		color: red;
		font-size: 26rpx;
		padding: 20px 0;
	}

	.sub-btn {
		width: 690rpx;
		height: 100rpx;
		background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
		border-radius: 8rpx;
		box-shadow: 0px 0px 8rpx 0px rgba(51, 135, 255, 0.20);
		text-align: center;
		line-height: 100rpx;
		color: #fff;
		font-size: 36rpx;
		font-weight: bold;
		position: fixed;
		left: 50%;
		bottom: 10rpx;
		transform: translateX(-50%);
		z-index: 99;
	}
</style>
