distriRuleDetail.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view class="container">
  3. <form @submit="onSubmit">
  4. <view class="page-block">
  5. <view class="content">
  6. <view class="cell flex flex-y-center">
  7. <view class="title-block required">
  8. <text>规则名称:</text>
  9. </view>
  10. <view class="desc">
  11. <input type="text" :value="info.name" name="name" class="input-box" placeholder="请输入规则名称"
  12. placeholder-class="desc-placeholder">
  13. </view>
  14. </view>
  15. <view class="cell flex flex-y-center">
  16. <view class="title-block required">
  17. <text>配送距离起始值:</text>
  18. </view>
  19. <view class="desc">
  20. <input type="digit" :value="info.start" name="start" class="input-box"
  21. placeholder="请填写配送距离起始值(公里)" placeholder-class="desc-placeholder">
  22. </view>
  23. </view>
  24. <view class="cell flex flex-y-center">
  25. <view class="title-block required">
  26. <text>配送距离结束值:</text>
  27. </view>
  28. <view class="desc">
  29. <input type="digit" :value="info.end" name="end" class="input-box"
  30. placeholder="请填写配送距离结束值(公里)" placeholder-class="desc-placeholder">
  31. </view>
  32. </view>
  33. <view class="cell flex flex-y-center">
  34. <view class="title-block required">
  35. <text>配送费</text>
  36. </view>
  37. <view class="desc">
  38. <input type="digit" :value="info.price" name="price" class="input-box" placeholder="请输入配送费"
  39. placeholder-class="desc-placeholder">
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="footer-bar">
  45. <view class="content flex flex-center" style="background: none;">
  46. <button class="btn" hover-class="none" form-type="submit">
  47. {{info.id?'修改':'添加'}}
  48. </button>
  49. </view>
  50. </view>
  51. </form>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. data() {
  57. return {
  58. device_type: 1,
  59. tableType: "",
  60. admin_id: "",
  61. info: {},
  62. detail: {},
  63. is_integral: 1,
  64. type: 2,
  65. id: '',
  66. store_id: "",
  67. }
  68. },
  69. onLoad(e) {
  70. if (e.id) {
  71. this.delivery_rule_info(e.id);
  72. this.id = e.id;
  73. uni.setNavigationBarTitle({
  74. title: "修改规则"
  75. })
  76. }
  77. this.admin_id = uni.getStorageSync("admin_id");
  78. },
  79. methods: {
  80. delivery_rule_info(id) {
  81. this.request({
  82. url: 'Smdcshop/delivery_rule_info',
  83. data: {
  84. admin_id: this.admin_id,
  85. id: id,
  86. }
  87. }).then(res => {
  88. if (res.code == 200) {
  89. this.info = res.data
  90. }
  91. })
  92. },
  93. onSubmit(e) {
  94. let params = e.detail.value;
  95. params.admin_id = this.admin_id
  96. if (this.id) {
  97. params.id = this.info.id
  98. }
  99. if (!params.name||!params.start||!params.end||!params.price) {
  100. uni.showToast({
  101. title: "必选不能为空",
  102. icon: 'none'
  103. })
  104. return false
  105. }
  106. this.request({
  107. url: "Smdcshop/delivery_rule_save",
  108. data: params
  109. }).then(res => {
  110. if (res.code == 200) {
  111. uni.showToast({
  112. title: res.message,
  113. icon: 'none'
  114. })
  115. setTimeout(() => {
  116. uni.navigateBack()
  117. }, 2000)
  118. }
  119. }).catch((res) => {
  120. uni.showToast({
  121. title: res.message,
  122. icon: 'none'
  123. })
  124. });
  125. },
  126. }
  127. }
  128. </script>
  129. <style>
  130. @import url("./static/css/common.css");
  131. page {
  132. background-color: #F4F5F7;
  133. }
  134. .checklist-box {
  135. display: -webkit-box;
  136. display: -webkit-flex;
  137. display: flex;
  138. -webkit-box-orient: horizontal;
  139. -webkit-box-direction: normal;
  140. -webkit-flex-direction: row;
  141. flex-direction: row;
  142. -webkit-box-align: center;
  143. -webkit-align-items: center;
  144. align-items: center;
  145. margin: 5px 0;
  146. margin-right: 22px;
  147. }
  148. .radio__inner {
  149. -webkit-flex-shrink: 0;
  150. flex-shrink: 0;
  151. display: -webkit-box;
  152. display: -webkit-flex;
  153. display: flex;
  154. -webkit-box-pack: center;
  155. -webkit-justify-content: center;
  156. justify-content: center;
  157. -webkit-box-align: center;
  158. -webkit-align-items: center;
  159. align-items: center;
  160. position: relative;
  161. border: 1px solid #DCDFE6;
  162. border-radius: 2px;
  163. box-sizing: border-box;
  164. width: 16px;
  165. height: 16px;
  166. border-radius: 16px;
  167. background-color: #fff;
  168. z-index: 1;
  169. -webkit-transition: border-color .3s;
  170. transition: border-color .3s;
  171. }
  172. .radio__inner-icon {
  173. width: 8px;
  174. height: 8px;
  175. border-radius: 10px;
  176. opacity: 0;
  177. -webkit-transition: -webkit-transform .3s;
  178. transition: -webkit-transform .3s;
  179. transition: transform .3s;
  180. transition: transform .3s, -webkit-transform .3s;
  181. }
  182. .is-default-checked {
  183. opacity: 1;
  184. background-color: #007aff;
  185. -webkit-transform: rotate(45deg) scaleY(1);
  186. transform: rotate(45deg) scaleY(1);
  187. }
  188. .checklist-text {
  189. font-size: 28rpx;
  190. margin-left: 5px;
  191. -webkit-transition: color 0.2s;
  192. transition: color 0.2s;
  193. color: #000;
  194. }
  195. .act_border {
  196. border: 1rpx solid #007aff;
  197. }
  198. </style>