1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <template>
- <view>
- <view class="forms">
- <view class="form_group pt0">
- <view class="lable re">收件人</view>
- <input placeholder="请输入" v-model="item.typeCode" />
- </view>
- <view class="form_group">
- <view class="lable re">联系电话</view>
- <input placeholder="请输入" v-model="item.typeCode" />
- </view>
- <view class="form_group">
- <view class="lable re">详细地址</view>
- <textarea v-model="item.remarks" placeholder="请输入"></textarea>
- </view>
- </view>
- <view class="mfooter">
- <view class="flex">
- <view class="f" v-if="item.id">
- <button class="save btn" @click="del()">删除</button>
- </view>
- <view class="f">
- <button class="btn" @click="save()">保存</button>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- item: {}
- };
- },
- onLoad(e) {
- if (e.id) {
- this.http.request({
- url: '/level-one-server/app/TbPortNews/getPortNewsDetails',
- data: { id: e.id },
- success: res => {
- this.item = res.data.data;
- }
- });
- }
- },
- methods: {
- save() {
- let rule = [
- { name: 'typeCode', checkType: 'notnull', errorMsg: '请输入编码' },
- { name: 'typeName', checkType: 'notnull', errorMsg: '请输入名称' },
- { name: 'status', checkType: 'notnull', errorMsg: '请选择状态' }
- ];
- if (!this.verify.check(this.item, rule)) {
- uni.showModal({ content: this.verify.error, showCancel: false });
- return false;
- }
- this.http.request({
- url: '/project/projectType',
- method: 'POST',
- data: this.item,
- success: res => {
- uni.showToast({ title: '操作成功' });
- setTimeout(() => {
- uni.$emit('address');
- uni.navigateBack();
- }, 1000);
- }
- });
- },
- del(id) {
- uni.showModal({
- title: '提示',
- content: '确定删除该数据?',
- success: res => {
- if (res.confirm) {
- this.http.request({
- url: '/customer/customerType',
- data: { id: this.item.id },
- method: 'POST',
- success: res => {
- uni.showToast({ title: '删除成功' });
- setTimeout(() => {
- uni.$emit('address');
- uni.navigateBack();
- }, 1000);
- }
- });
- }
- }
- });
- }
- }
- };
- </script>
- <style lang="scss"></style>
|