123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <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="num" :value="obj.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>支付金额</text>
- </view>
- <view class="desc">
- <input type="num" :value="obj.pay_price" name="pay_price" class="input-box"
- placeholder="用户支付多少就充值多少" 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="num" :value="obj.send_price" name="send_price" class="input-box"
- placeholder="用户充值时,赠送的金额,默认为0" placeholder-class="desc-placeholder">
- </view>
- </view>
- <view class="cell flex flex-y-center">
- <view class="title-block requsired">
- <text>排序</text>
- </view>
- <view class="desc">
- <input type="num" :value="obj.num" class="input-box" placeholder="请输入"
- placeholder-class="desc-placeholder">
- </view>
- </view>
-
- </view>
- </view>
- <view class="footer-bar">
- <view class="content flex flex-center" style="background: none;">
- <button class="btn" hover-class="none" form-type="submit">
- {{obj.id?'修改':'添加'}}
- </button>
- </view>
- </view>
- </form>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- is_integral:0,
- device_type: 1,
- tableType: "",
- store_id: "",
- info: {},
- obj:{},
- }
- },
- onLoad(e) {
- if (e.id) {
- this.info = e;
- this.http();
- uni.setNavigationBarTitle({
- title:"修改充值方案"
- })
- }
-
-
- this.admin_id = uni.getStorageSync("admin_id");
- },
- methods: {
-
- http(){
- this.request({
- url:"Smdcshop/recharge_info",
- data: {
- id:this.info.id,
- }
- }).then(res => {
- if (res.code == 200) {
- this.obj=res.data;
- }
- }).catch((res) => {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- });
- },
-
- onSubmit(e) {
- let params = e.detail.value,
- url;
- params.admin_id=this.admin_id;
- if (this.info.id) {
- params.id = this.info.id
- url = "Smdcshop/recharge_update"
- } else {
- url = 'Smdcshop/recharge_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;
- }
- </style>
|