123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 |
- <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">
- <view class="title-block ">
- <text>活动类型</text>
- </view>
- <view class="title-block">
- 实体大转盘
- </view>
- </view>
- <view class="box-pack-between ft32 cell flex-y-center">
- <text class="item_name ft28">选择活动<text style="color:red">*</text></text>
- <picker class="ft28" :range="game_list" range-key="name" @change="bindGame">
- <view class="flex-y-center">
- <!-- <view v-if="game_index<=-1">{{game_name}}</view> -->
- <view>{{game_list[0].name}}</view>
- <text class="iconfont icon-prev"></text>
- </view>
- </picker>
- </view>
- <view class="cell flex flex-y-center">
- <view class="title-block ">
- <text>跳转类型</text>
- </view>
- <view class="desc">
- <view class="flex-center">
- <view class="checklist-box " @click="choicepay(item.num)"
- v-for="(item,index) of integral_arr" :key='index'
- :class="is_integral==item.num?'actt':''">
- <view class="radio__inner" :class="is_integral==item.num?'act_border':''">
- <view :class="is_integral==item.num?'is-default-checked':''"
- class="radio__inner-icon radio__inner-icon ">
- </view>
- </view>
- <text class="checklist-text">{{item.name}}</text>
- </view>
- </view>
- </view>
- </view>
- <view class="flex cell desc-title" @click="ChooseImage" v-if="is_integral==1">
- <view class="">
- 加群二维码
- </view>
- <image v-if="thumb" class="logo-img" :src="URL+''+thumb">
- </image>
- <image v-else class="desc-img" src="../static/images/icon_6.png" mode=""></image>
- </view>
- <view class="" v-if="is_integral==2">
- <view class="cell flex flex-y-center">
- <view class="title-block required">
- <text>微信小程序AppID</text>
- </view>
- <view class="desc">
- <input type="text" :value="info.name" name="name" class="input-box"
- placeholder="请输入小程序AppID" placeholder-class="desc-placeholder">
- </view>
- </view>
- <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">
- <view class="title-block required">
- <text>支付宝小程序AppID</text>
- </view>
- <view class="desc">
- <input type="text" :value="info.name" name="name" class="input-box"
- placeholder="请输入小程序AppID" placeholder-class="desc-placeholder">
- </view>
- </view>
- <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>
- </view>
- </view>
- <view class="footer-bar">
- <view class="content flex flex-center" style="background: none;">
- <!-- <view class="btn">立即添加</view> -->
- <button class="btn" hover-class="none" form-type="submit">
- {{info.id?'修改类型':'立即添加'}}
- </button>
- </view>
- </view>
- </form>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- URL: getApp().globalData.URL,
- tableTypeList: ['大桌', '中桌', '小桌'],
- tableType: "",
- store_id: "",
- info: {},
- is_integral: 1,
- game_list: [],
- integral_arr: [{
- num: 0,
- name: "不跳转"
- },
- {
- num: 1,
- name: "加群码"
- },
- {
- num: 2,
- name: "小程序"
- }
- ],
- thumb:""
- }
- },
- onLoad(e) {
- if (e.id) {
- // this.info=e;
- this.getData(e.id)
- }
- this.store_id = uni.getStorageSync("store_id");
- },
- methods: {
- ChooseImage(e) {
- // let type = e.currentTarget.dataset.type;
- uni.chooseImage({
- count: 1, //默认9
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album'], //从相册选择
- success: (res) => {
- console.log(res)
- // var tempFilesSize = res.tempFiles[0].size;//获取图片的大小,单位B
- res.tempFilePaths.forEach((v, i) => {
- // console.log(v)
- this.Upload({
- url: "Smdcshop/upload",
- data: {
- url: v,
- type: "",
- token: "",
- admin_id: uni.getStorageSync("admin_id")
- }
- }).then(res => {
- console.log(res, "res")
- this.imgid = res.id;
- this.thumb = res.src;
- }).catch(err => {
- uni.showToast({
- title: err.message,
- icon: 'none'
- })
- });
- })
- },
- });
- },
- choicepay(e) {
- this.is_integral = e;
- },
- getData(id) {
- this.request({
- url: 'Smdcshop/table_type_update_info',
- data: {
- id: id
- }
- }).then(res => {
- if (res.code == "200") {
- this.info = res.data
- } else {
- this.is_bottom = true
- }
- })
- },
- onSubmit(e) {
- let params = {
- admin_id: uni.getStorageSync("admin_id"),
- store_id: this.store_id,
- name: e.detail.value.name,
- num: e.detail.value.num,
- source: 0,
- mark: e.detail.value.mark,
- content: e.detail.value.content,
- },
- url;
- if (this.info.id) {
- params.id = this.info.id
- url = "Smdcshop/table_type_update"
- } else {
- url = 'Smdcshop/table_type_add'
- }
- if (params.name == "") {
- uni.showToast({
- title: "请输入名称",
- icon: 'none'
- })
- return false
- }
- this.request({
- url,
- data: params
- }).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;
- }
- .desc-title {
- font-size: 26rpx;
- padding: 20rpx 0;
- }
- .desc-img {
- width: 150rpx;
- height: 150rpx;
- margin-left: 30rpx;
- }
- .checklist-box {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-orient: horizontal;
- -webkit-box-direction: normal;
- -webkit-flex-direction: row;
- flex-direction: row;
- -webkit-box-align: center;
- -webkit-align-items: center;
- align-items: center;
- margin: 5px 0;
- margin-right: 22px;
- }
- .radio__inner {
- -webkit-flex-shrink: 0;
- flex-shrink: 0;
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- -webkit-box-align: center;
- -webkit-align-items: center;
- align-items: center;
- position: relative;
- border: 1px solid #DCDFE6;
- border-radius: 2px;
- box-sizing: border-box;
- width: 16px;
- height: 16px;
- border-radius: 16px;
- background-color: #fff;
- z-index: 1;
- -webkit-transition: border-color .3s;
- transition: border-color .3s;
- }
- .radio__inner-icon {
- width: 8px;
- height: 8px;
- border-radius: 10px;
- opacity: 0;
- -webkit-transition: -webkit-transform .3s;
- transition: -webkit-transform .3s;
- transition: transform .3s;
- transition: transform .3s, -webkit-transform .3s;
- }
- .is-default-checked {
- opacity: 1;
- background-color: #007aff;
- -webkit-transform: rotate(45deg) scaleY(1);
- transform: rotate(45deg) scaleY(1);
- }
- .checklist-text {
- font-size: 28rpx;
- margin-left: 5px;
- -webkit-transition: color 0.2s;
- transition: color 0.2s;
- color: #000;
- }
- .act_border {
- border: 1rpx solid #007aff;
- }
- </style>
|