operatorInfo.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <view>
  3. <view class="form">
  4. <form>
  5. <view class="uni-form-item">
  6. <view class="title">运营商名称</view>
  7. <view class="input">
  8. <input placeholder="运营商名称" v-model="formData.name" style="margin-left: 30rpx;" />
  9. </view>
  10. </view>
  11. <view class="uni-form-item">
  12. <view class="title">运营商编号</view>
  13. <view class="input">
  14. <input placeholder="运营商编号" v-model="formData.number" style="margin-left: 30rpx;" />
  15. </view>
  16. </view>
  17. <view class="uni-form-item">
  18. <view class="title">省份</view>
  19. <view class="input">
  20. <input placeholder="省份" v-model="formData.province" style="margin-left: 30rpx;" />
  21. </view>
  22. </view>
  23. <view class="uni-form-item">
  24. <view class="title">城市</view>
  25. <view class="input">
  26. <input placeholder="城市" v-model="formData.city" style="margin-left: 30rpx;" />
  27. </view>
  28. </view>
  29. <view class="uni-form-item">
  30. <view class="title">详细地址</view>
  31. <view class="input">
  32. <input placeholder="详细地址" v-model="formData.address" style="margin-left: 30rpx;" />
  33. </view>
  34. </view>
  35. <view class="uni-form-item">
  36. <view class="title">联系人</view>
  37. <view class="input">
  38. <input placeholder="联系人" v-model="formData.contact" style="margin-left: 30rpx;" />
  39. </view>
  40. </view>
  41. <view class="uni-form-item">
  42. <view class="title">联系电话</view>
  43. <view class="input">
  44. <input placeholder="联系电话" v-model="formData.tel" style="margin-left: 30rpx;" />
  45. </view>
  46. </view>
  47. <view class="uni-btn-v">
  48. <button class="button1" @tap="del">删除</button>
  49. <button class="button2" @tap="edit">修改</button>
  50. </view>
  51. </form>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. formData: {
  60. code: '',
  61. name: '',
  62. number: '',
  63. contact: '',
  64. tel: '',
  65. address: '',
  66. province: '',
  67. city: '',
  68. status: ''
  69. }
  70. }
  71. },
  72. onLoad(e) {
  73. console.log(e);
  74. uni.request({
  75. url: 'http://127.0.0.1:9999/operator/detail?code=' + e.code,
  76. method: 'GET',
  77. data: {},
  78. success: res => {
  79. this.formData = res.data.data.operator;
  80. console.log(this.formData);
  81. },
  82. });
  83. },
  84. methods: {
  85. async edit(e) {
  86. let vm = this;
  87. let url = uni.$api.operator.update;
  88. let data = {
  89. code: this.formData.code,
  90. status: 1,
  91. name: this.formData.name,
  92. number: this.formData.number,
  93. contact: this.formData.contact,
  94. tel: this.formData.tel,
  95. address: this.formData.address,
  96. province: this.formData.province,
  97. city: this.formData.city,
  98. };
  99. let res = await uni.$http.get(url, data);
  100. console.log('form发生了submit事件')
  101. console.log(res);
  102. },
  103. async del(e) {
  104. let vm = this;
  105. let url = uni.$api.operator.delete;
  106. let data = {
  107. code: this.formData.code,
  108. }
  109. uni.showModal({
  110. title: '提示',
  111. content: '确认删除此信息?',
  112. async success(e) {
  113. console.log(e);
  114. if (e.confirm) {
  115. // 执行确认后的操作
  116. let res = await uni.$http.get(url, data)
  117. uni.$emit('flush');
  118. uni.switchTab({
  119. url:'/pages/operator/operator'
  120. })
  121. } else {
  122. }
  123. },
  124. })
  125. }
  126. }
  127. }
  128. </script>
  129. <style>
  130. .title {
  131. margin-left: 30rpx;
  132. margin-top: 20rpx;
  133. margin-bottom: 20rpx;
  134. font-size: 26rpx;
  135. }
  136. .form {
  137. margin-top: 26rpx;
  138. padding-top: 10rpx;
  139. background-color: white;
  140. width: 702rpx;
  141. height: 1220rpx;
  142. margin-left: 24rpx;
  143. border-radius: 10rpx;
  144. }
  145. .input {
  146. background-color: #F7F8F9;
  147. width: 654rpx;
  148. margin-left: 24rpx;
  149. height: 98rpx;
  150. border-radius: 10rpx;
  151. display: flex;
  152. align-items: center;
  153. }
  154. .uni-btn-v {
  155. margin-top: 40rpx;
  156. display: flex;
  157. flex-direction: row;
  158. }
  159. .button1 {
  160. width: 315rpx;
  161. height: 76rpx;
  162. margin-top: 30rpx;
  163. background-color: #E02021;
  164. color: white;
  165. font-size: unset;
  166. }
  167. .button2 {
  168. width: 315rpx;
  169. height: 76rpx;
  170. margin-top: 30rpx;
  171. background-color: #007AFF;
  172. color: white;
  173. font-size: unset;
  174. }
  175. </style>