123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- <template>
- <view>
- <view class="form">
- <form>
- <view class="uni-form-item">
- <view class="title">运营商名称</view>
- <view class="input">
- <input placeholder="运营商名称" v-model="formData.name" style="margin-left: 30rpx;" />
- </view>
- </view>
- <view class="uni-form-item">
- <view class="title">运营商编号</view>
- <view class="input">
- <input placeholder="运营商编号" v-model="formData.number" style="margin-left: 30rpx;" />
- </view>
- </view>
- <view class="uni-form-item">
- <view class="title">省份</view>
- <view class="input">
- <input placeholder="省份" v-model="formData.province" style="margin-left: 30rpx;" />
- </view>
- </view>
- <view class="uni-form-item">
- <view class="title">城市</view>
- <view class="input">
- <input placeholder="城市" v-model="formData.city" style="margin-left: 30rpx;" />
- </view>
- </view>
- <view class="uni-form-item">
- <view class="title">详细地址</view>
- <view class="input">
- <input placeholder="详细地址" v-model="formData.address" style="margin-left: 30rpx;" />
- </view>
- </view>
- <view class="uni-form-item">
- <view class="title">联系人</view>
- <view class="input">
- <input placeholder="联系人" v-model="formData.contact" style="margin-left: 30rpx;" />
- </view>
- </view>
- <view class="uni-form-item">
- <view class="title">联系电话</view>
- <view class="input">
- <input placeholder="联系电话" v-model="formData.tel" style="margin-left: 30rpx;" />
- </view>
- </view>
- <view class="uni-btn-v">
- <button class="button1" @tap="del">删除</button>
- <button class="button2" @tap="edit">修改</button>
- </view>
- </form>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- formData: {
- code: '',
- name: '',
- number: '',
- contact: '',
- tel: '',
- address: '',
- province: '',
- city: '',
- status: ''
- }
- }
- },
- onLoad(e) {
- console.log(e);
- uni.request({
- url: 'http://127.0.0.1:9999/operator/detail?code=' + e.code,
- method: 'GET',
- data: {},
- success: res => {
- this.formData = res.data.data.operator;
- console.log(this.formData);
- },
- });
- },
- methods: {
- async edit(e) {
- let vm = this;
- let url = uni.$api.operator.update;
- let data = {
- code: this.formData.code,
- status: 1,
- name: this.formData.name,
- number: this.formData.number,
- contact: this.formData.contact,
- tel: this.formData.tel,
- address: this.formData.address,
- province: this.formData.province,
- city: this.formData.city,
- };
- let res = await uni.$http.get(url, data);
- console.log('form发生了submit事件')
- console.log(res);
- },
- async del(e) {
- let vm = this;
- let url = uni.$api.operator.delete;
- let data = {
- code: this.formData.code,
- }
- uni.showModal({
- title: '提示',
- content: '确认删除此信息?',
- async success(e) {
- console.log(e);
- if (e.confirm) {
- // 执行确认后的操作
- let res = await uni.$http.get(url, data)
- uni.$emit('flush');
- uni.switchTab({
- url:'/pages/operator/operator'
- })
-
- } else {
- }
- },
- })
- }
- }
- }
- </script>
- <style>
- .title {
- margin-left: 30rpx;
- margin-top: 20rpx;
- margin-bottom: 20rpx;
- font-size: 26rpx;
- }
- .form {
- margin-top: 26rpx;
- padding-top: 10rpx;
- background-color: white;
- width: 702rpx;
- height: 1220rpx;
- margin-left: 24rpx;
- border-radius: 10rpx;
- }
- .input {
- background-color: #F7F8F9;
- width: 654rpx;
- margin-left: 24rpx;
- height: 98rpx;
- border-radius: 10rpx;
- display: flex;
- align-items: center;
- }
- .uni-btn-v {
- margin-top: 40rpx;
- display: flex;
- flex-direction: row;
- }
- .button1 {
- width: 315rpx;
- height: 76rpx;
- margin-top: 30rpx;
- background-color: #E02021;
- color: white;
- font-size: unset;
- }
- .button2 {
- width: 315rpx;
- height: 76rpx;
- margin-top: 30rpx;
- background-color: #007AFF;
- color: white;
- font-size: unset;
- }
- </style>
|