index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view>
  3. <view class="cell ">
  4. <view class="title-block">
  5. <text> 首页弹窗开关</text>
  6. </view>
  7. <view class="desc">
  8. <view class="desc-content" v-for="(item,index) of zt_list" :key='index'>
  9. <view class="checklist-box" @click="choicezt(index)" :class="is_zt==index?'actt':''">
  10. <view class="radio__inner" :class="is_zt==index?'act_border':''">
  11. <view :class="is_zt==index?'is-default-checked':''"
  12. class="radio__inner-icon radio__inner-icon ">
  13. </view>
  14. </view>
  15. <text class="checklist-text">{{item}}</text>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="title-block" v-if="is_zt==2">
  21. <navigator :url="`../../../saomaDiancan/couponList/couponList?store_id=${store_id}`" class="navURL ">
  22. 优惠券:点击跳转设置首页优惠券
  23. </navigator>
  24. </view>
  25. <view class="cell">
  26. <view class="title-block">
  27. <text>弹窗时间</text>
  28. </view>
  29. <view class="desc">
  30. <view class="" style="display: inline-block;" v-for="(item,index) of day_list" :key='index'>
  31. <view class="checklist-box" @click="choiceDay(index)" :class="is_day==index?'actt':''">
  32. <view class="radio__inner" :class="is_day==index?'act_border':''">
  33. <view :class="is_day==index?'is-default-checked':''"
  34. class="radio__inner-icon radio__inner-icon ">
  35. </view>
  36. </view>
  37. <text class="checklist-text">{{item}}</text>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="sub-btn" @click="submit">
  43. 提交
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. return {
  51. zt_list: ["关闭", "语音播报", "优惠劵", "轮播图"],
  52. is_zt: 0,
  53. day_list: ["每天一次", "每天每次"],
  54. is_day: 0,
  55. id:'',store_id:'',
  56. }
  57. },
  58. onLoad() {
  59. this.store_id=uni.getStorageSync("store_id");
  60. this.index_set_info();
  61. },
  62. methods: {
  63. index_set_info() {
  64. this.request({
  65. url: "Smdcshop/index_set_info",
  66. data: {
  67. admin_id: uni.getStorageSync("admin_id"),
  68. }
  69. }).then(res => {
  70. if (res.code == 200) {
  71. this.is_zt = res.data.is_pop;
  72. this.is_day = res.data.pop_day-1;
  73. this.id=res.data.id;
  74. }
  75. }).catch((res) => {
  76. uni.showToast({
  77. title: res.message,
  78. icon: 'none'
  79. })
  80. });
  81. },
  82. choicezt(e) {
  83. this.is_zt = e;
  84. },
  85. choiceDay(e) {
  86. this.is_day = e;
  87. },
  88. submit() {
  89. //is_pop 0关闭弹窗 1语音播报弹窗,2优惠券弹窗,3轮播图弹窗,
  90. //pop_day 1每天一次 2每天
  91. this.request({
  92. url: "Smdcshop/index_set",
  93. data: {
  94. admin_id: uni.getStorageSync("admin_id"),
  95. is_pop: this.is_zt,
  96. pop_day: this.is_day + 1,
  97. id:this.id,
  98. }
  99. }).then(res => {
  100. if (res.code == 200) {
  101. uni.showToast({
  102. title: res.message,
  103. icon: 'none'
  104. })
  105. setTimeout(() => {
  106. uni.navigateBack()
  107. }, 2000)
  108. }
  109. }).catch((res) => {
  110. uni.showToast({
  111. title: res.message,
  112. icon: 'none'
  113. })
  114. });
  115. },
  116. }
  117. }
  118. </script>
  119. <style>
  120. page {
  121. background-color: #F1F1F1;
  122. }
  123. .navURL{
  124. font-size: 28rpx;
  125. color: red;
  126. }
  127. .desc {
  128. padding: 20rpx 25rpx;
  129. background-color: #FFFFFF;
  130. border-bottom: 1rpx solid #F1F1F1;
  131. width: 690rpx;
  132. margin: 0 auto;
  133. border-radius: 12rpx;
  134. }
  135. .desc-content {
  136. display: inline-block;
  137. }
  138. .title-block {
  139. font-size: 28rpx;
  140. padding: 20rpx 30rpx;
  141. color: #999999;
  142. }
  143. page .act_border {
  144. border: 1rpx solid #007AFF;
  145. }
  146. .checklist-box {
  147. display: -webkit-box;
  148. display: -webkit-flex;
  149. display: flex;
  150. -webkit-box-orient: horizontal;
  151. -webkit-box-direction: normal;
  152. -webkit-flex-direction: row;
  153. flex-direction: row;
  154. -webkit-box-align: center;
  155. -webkit-align-items: center;
  156. align-items: center;
  157. margin: 5px 0;
  158. margin-right: 22px;
  159. }
  160. .radio__inner {
  161. -webkit-flex-shrink: 0;
  162. flex-shrink: 0;
  163. display: -webkit-box;
  164. display: -webkit-flex;
  165. display: flex;
  166. -webkit-box-pack: center;
  167. -webkit-justify-content: center;
  168. justify-content: center;
  169. -webkit-box-align: center;
  170. -webkit-align-items: center;
  171. align-items: center;
  172. position: relative;
  173. border: 1px solid #DCDFE6;
  174. border-radius: 2px;
  175. box-sizing: border-box;
  176. width: 16px;
  177. height: 16px;
  178. border-radius: 16px;
  179. background-color: #fff;
  180. z-index: 1;
  181. -webkit-transition: border-color .3s;
  182. transition: border-color .3s;
  183. }
  184. .radio__inner-icon {
  185. width: 8px;
  186. height: 8px;
  187. border-radius: 10px;
  188. opacity: 0;
  189. -webkit-transition: -webkit-transform .3s;
  190. transition: -webkit-transform .3s;
  191. transition: transform .3s;
  192. transition: transform .3s, -webkit-transform .3s;
  193. }
  194. .is-default-checked {
  195. opacity: 1;
  196. background-color: #007aff;
  197. -webkit-transform: rotate(45deg) scaleY(1);
  198. transform: rotate(45deg) scaleY(1);
  199. }
  200. .checklist-text {
  201. font-size: 28rpx;
  202. margin-left: 5px;
  203. -webkit-transition: color 0.2s;
  204. transition: color 0.2s;
  205. color: #000;
  206. }
  207. .sub-btn {
  208. width: 690rpx;
  209. height: 100rpx;
  210. background: -webkit-linear-gradient(135deg, #3387ff 2%, #569bff 99%);
  211. background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
  212. border-radius: 8rpx;
  213. box-shadow: 0px 0px 8rpx 0px rgba(51, 135, 255, 0.20);
  214. text-align: center;
  215. line-height: 100rpx;
  216. color: #fff;
  217. font-size: 36rpx;
  218. font-weight: bold;
  219. margin: 0 auto;
  220. margin-top: 30px;
  221. }
  222. </style>