123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <template>
- <view class="container">
- <form @submit="onSubmit">
- <view class="page-block">
- <view class="content">
- <view class="cell flex flex-y-center">
- <view class="title-block required">
- <text>名称</text>
- </view>
- <view class="desc">
- <input type="text" :value="info.name" name="name" class="input-box" placeholder="请输入"
- placeholder-class="desc-placeholder">
- </view>
- </view>
- <view class="cell flex flex-y-center arr-r">
- <view class="title-block">
- <text>来源</text>
- </view>
-
- <view class="desc">
- <picker mode="selector" :range="TypeList" @change="onTableTypeChange">
- <view>
- {{TypeList[TypeActive]}}
- </view>
- </picker>
- </view>
- </view>
- <view class="cell flex flex-y-center">
- <view class="title-block">
- <text>简介</text>
- </view>
- <view class="desc">
- <input type="text" :value="info.desc" name="desc" class="input-box" placeholder="请输入"
- placeholder-class="desc-placeholder">
- </view>
- </view>
- <view class="cell flex flex-y-center">
- <view class="title-block required">
- <text>appid</text>
- </view>
- <view class="desc">
- <input type="text" :value="info.appid" name="appid" class="input-box" placeholder="请输入"
- placeholder-class="desc-placeholder">
- </view>
- </view>
- <view class="cell flex flex-y-center">
- <view class="title-block">
- <text>跳转路径</text>
- </view>
- <view class="desc">
- <input type="text" :value="info.pages" name="pages" class="input-box" placeholder="请输入"
- placeholder-class="desc-placeholder">
- </view>
- </view>
- </view>
- </view>
-
- <view style="height: 150rpx;"></view>
-
- <view class="footer-bar">
- <view class="content flex flex-center" style="background: none;">
- <button hover-class="none" class="btn" form-type="submit">
- {{id?'保存':'立即添加'}}
- </button>
- </view>
- </view>
- </form>
- </view>
- </template>
- <script>
- export default {
- data() {
-
- return {
- admin_id: "",
- id: "",
- TypeList: [
- "微信",
- "支付宝",
- ],
-
- TypeActive: 0,
-
- table_type_id: "",
- info:{},
- }
- },
-
-
- onLoad(options) {
- this.admin_id = uni.getStorageSync('admin_id')
- if (options.id) {
- this.id = options.id;
- this.applet_info()
- }
-
-
- },
- methods: {
-
- onTableTypeChange(e) {
- this.TypeActive = e.detail.value
- },
-
- //获取桌台分类
- applet_info() {
- this.request({
- url: 'Smdcshop/applet_info',
- data: {
- id: this.id
- }
- }).then(res => {
- if (res.code == '200' || res.code == 200) {
- this.info = res.data
-
- this.TypeActive = Number(res.data.type-1);
-
- }
- })
- },
- onSubmit(e) {
- let detail=e.detail.value;
- if (!detail.name) {
- uni.showToast({
- title: "请输入名称",
- icon: 'none'
- })
- return false
- }
- if (!detail.appid) {
- uni.showToast({
- title: "请输入appid",
- icon: 'none'
- })
- return false
- }
- detail.admin_id = this.admin_id;
- detail.type= Number(this.TypeActive)+1;
- if (this.id) {
- detail.id = this.id;
- }
- this.request({
- url: this.id?'Smdcshop/applet_update':'Smdcshop/applet_add',
- data: detail
- }).then(res => {
- if (res.code == 200) {
- uni.showModal({
- content: this.table_id ? '编辑成功' : '添加成功',
- showCancel: false,
- success: (r) => {
- uni.navigateBack();
- }
- })
- }
- })
- },
- }
- }
- </script>
- <style>
- @import url("../static/css/common.css");
- page {
- background-color: #F4F5F7;
- }
- </style>
|