delCode.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view>
  3. <view class="tr">
  4. <input class="input" style="display:none;" />
  5. <text>编号:</text><input class="input" name="coding" v-model="coding" />
  6. <button type="primary" @click="select()" class="button1">
  7. <p class="p">查询</p>
  8. </button>
  9. <button type="primary" @click="del()" class="button1">
  10. <p class="p">删除</p>
  11. </button>
  12. </view>
  13. <view class="tr">
  14. <input class="input" style="display:none;" />
  15. <text>名称:</text><p class="">{{name}}</p>
  16. </view>
  17. <view class="tr">
  18. <input class="input" style="display:none;" />
  19. <text>添加时间:</text><p class="">{{createDate}}</p>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. coding:null,
  28. name:'',
  29. createDate:''
  30. }
  31. },
  32. methods: {
  33. select(){
  34. var token = uni.getStorageSync("token");
  35. uni.request({
  36. url: this.serverurl + "/TCoding/select?coding=" + this.coding,
  37. method: "POST",
  38. header: {
  39. 'token': token
  40. },
  41. success: (Result) => {
  42. // console.log(Result);
  43. var res = Result;
  44. if(!res.data.code){
  45. uni.showModal({
  46. title: '提示',
  47. content: res.data.message,
  48. });
  49. }else{
  50. var data = res.data.data;
  51. this.name = data.name;
  52. this.createDate = data.createDate;
  53. }
  54. }
  55. });
  56. },
  57. del(){
  58. uni.showModal({
  59. title: '删除',
  60. content: '确定执行操作?',
  61. success: (res) => {
  62. if (res.confirm) {
  63. var that = this;
  64. var serverUrl = that.serverurl;
  65. var token = uni.getStorageSync("token");
  66. uni.request({
  67. url: serverUrl + "/TCoding/delete?coding=" + this.coding,
  68. method: "POST",
  69. header: {
  70. 'token': token
  71. },
  72. success: (Result) => {
  73. // console.log(Result);
  74. var res = Result;
  75. uni.showModal({
  76. title: '提示',
  77. content: res.data.message,
  78. });
  79. }
  80. });
  81. }
  82. }
  83. });
  84. }
  85. }
  86. }
  87. </script>
  88. <style>
  89. .tr {
  90. padding-left: 30upx;
  91. padding-top: 13upx;
  92. font-size: 30upx;
  93. padding-bottom: 13upx;
  94. display: flex;
  95. flex-direction: row;
  96. justify-content: flex-start;
  97. }
  98. .button1 {
  99. margin: auto;
  100. width: 75upx;
  101. height: 50upx;
  102. }
  103. .input {
  104. /* padding: 10upx 20upx 10upx 0upx; */
  105. padding-left: 20upx;
  106. padding-top: 10upx;
  107. background-color: #FFFFFF;
  108. width: 400upx;
  109. height: 50upx;
  110. box-shadow: 0upx 0upx 20upx #D3D3D3;
  111. border-radius: 5upx;
  112. }
  113. .p {
  114. /* #ifdef H5 */
  115. top: -13%;
  116. /* #endif */
  117. width: 50upx;
  118. height: 30upx;
  119. font-size: 25upx;
  120. padding-right: 9upx;
  121. padding-top: 6upx;
  122. /* #ifndef H5 */
  123. /* padding-top: 10upx; */
  124. /* #endif */
  125. position: absolute;
  126. /* 水平居中 */
  127. left: 50%;
  128. -webkit-transform: translateX(-50%);
  129. transform: translateX(-50%);
  130. }
  131. </style>