123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <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 required">
- <text>配送距离起始值:</text>
- </view>
- <view class="desc">
- <input type="digit" :value="info.start" name="start" 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="digit" :value="info.end" name="end" 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="digit" :value="info.price" name="price" 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">
- {{info.id?'修改':'添加'}}
- </button>
- </view>
- </view>
- </form>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- device_type: 1,
- tableType: "",
- admin_id: "",
- info: {},
- detail: {},
- is_integral: 1,
- type: 2,
- id: '',
- store_id: "",
- }
- },
- onLoad(e) {
- if (e.id) {
- this.delivery_rule_info(e.id);
- this.id = e.id;
- uni.setNavigationBarTitle({
- title: "修改规则"
- })
- }
- this.admin_id = uni.getStorageSync("admin_id");
- },
- methods: {
- delivery_rule_info(id) {
- this.request({
- url: 'Smdcshop/delivery_rule_info',
- data: {
- admin_id: this.admin_id,
- id: id,
- }
- }).then(res => {
- if (res.code == 200) {
- this.info = res.data
- }
- })
- },
- onSubmit(e) {
- let params = e.detail.value;
- params.admin_id = this.admin_id
- if (this.id) {
- params.id = this.info.id
- }
- if (!params.name||!params.start||!params.end||!params.price) {
- uni.showToast({
- title: "必选不能为空",
- icon: 'none'
- })
- return false
- }
- this.request({
- url: "Smdcshop/delivery_rule_save",
- 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;
- }
- .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>
|