index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <view class='content'>
  3. <view class='wrap'>
  4. <view>
  5. {{currectData.shopNames}}
  6. <image src="@/static/image/yjt.png" mode="" style="margin-left:10rpx;width:12rpx;height: 21rpx;"></image>
  7. </view>
  8. <view class='title'>营业管理</view>
  9. <u-cell-group>
  10. <u-cell title="营业时间" :isLink="true" arrow-direction="right">
  11. <view @click='selectTime' slot="title" class="u-slot-title flex justify-space-between">
  12. <view>营业时间</view>
  13. {{currectData.startDate}}~{{currectData.endDate}}
  14. </view>
  15. </u-cell>
  16. <u-cell title="店铺上架" :isLink="true" arrow-direction="right">
  17. <!-- <u-badge count="99" :absolute="false" slot="right-icon"></u-badge> -->
  18. <view slot="title" class="u-slot-title flex justify-space-between align-item-center">
  19. <view class="">
  20. 店铺上架
  21. </view>
  22. <view class='flex align-item-center'>
  23. <view style='margin-right:10rpx;'>{{currectData.status}}</view>
  24. <u-switch @change="change" slot="right-icon" v-model="checked"></u-switch>
  25. </view>
  26. </view>
  27. </u-cell>
  28. <u-cell title="删除店铺" :isLink="true" arrow-direction="right">
  29. <view @click='del' slot="title" class="u-slot-title">
  30. <view class="">
  31. 删除店铺
  32. </view>
  33. </view>
  34. </u-cell>
  35. </u-cell-group>
  36. <view class='title'>店铺信息</view>
  37. <u-cell-group>
  38. <u-cell title="店铺信息" :isLink="true" arrow-direction="right">
  39. <view @click='toDetail("/pageA/enter/myCateringdustry/shopSetting/editShopInformation")' slot="title" class="u-slot-title">
  40. <view class="">
  41. 店铺信息
  42. </view>
  43. </view>
  44. </u-cell>
  45. <u-cell title="店铺图片" :isLink="true" arrow-direction="right">
  46. <view @click='toDetail("/pageA/enter/myCateringdustry/shopSetting/editShopImage")' slot="title" class="u-slot-title">
  47. <view class="">
  48. 店铺图片
  49. </view>
  50. </view>
  51. </u-cell>
  52. <u-cell title="证照图片" :isLink="true" arrow-direction="right">
  53. <view @click='toDetail("/pageA/enter/myCateringdustry/shopSetting/editCertificate")' slot="title" class="u-slot-title">
  54. <view class="">
  55. 证照图片
  56. </view>
  57. </view>
  58. </u-cell>
  59. <u-cell @click='toDetail("/pageA/enter/myCateringdustry/shopSetting/editFoodClassify")' title="菜品分类" :isLink="true" arrow-direction="right">
  60. <view slot="title" class="u-slot-title">
  61. <view class="">
  62. 菜品分类
  63. </view>
  64. </view>
  65. </u-cell>
  66. <u-cell title="允许用户查看菜品价格" :isLink="true" arrow-direction="right">
  67. <view slot="title" class="u-slot-title flex justify-space-between">
  68. <view class="">
  69. 允许用户查看菜品价格
  70. </view>
  71. <u-switch @change='change1' slot="right-icon" v-model="checked1"></u-switch>
  72. </view>
  73. </u-cell>
  74. </u-cell-group>
  75. </view>
  76. <view style='margin:10px;' class='flex justify-space-between align-item-center'>
  77. <view @click='toDetail("/pageA/enter/myCateringdustry/shopSetting/foodInfomation")' class='mercharts_button'>菜品信息</view>
  78. <!-- <view @click='toDetail("/pageA/enter/myCateringdustry/shopSetting/editFoodClassify")' class='mercharts_button'>团购信息</view> -->
  79. </view>
  80. <smh-time-range :is-under='show' :time="time" @confrim="confrim" @cancel="cancel"></smh-time-range>
  81. <u-modal :show="isSubmit" :content='content' @confirm="$u.debounce(confirmSubmit, 500)" showCancelButton
  82. @cancel="isSubmit=false" @close="isSubmit=false" closeOnClickOverlay></u-modal>
  83. <u-modal :show="isDel" content='确定删除店铺?' @confirm="$u.debounce(confirmDelSubmit, 500)" showCancelButton
  84. @cancel="isDel=false" @close="isDel=false" closeOnClickOverlay></u-modal>
  85. <u-modal :show="isStatus" :content='content' @confirm="$u.debounce(confirmStatusSubmit, 500)" showCancelButton
  86. @cancel="isStatus=false" @close="isStatus=false" closeOnClickOverlay></u-modal>
  87. </view>
  88. </template>
  89. <script>
  90. var that
  91. export default {
  92. data() {
  93. return {
  94. content:'确定下架店铺?',
  95. isSubmit:false,
  96. isStatus:false,
  97. isDel:false,
  98. checked:true,
  99. checked1:true,
  100. show:false,
  101. time:[],
  102. currectStatus:1,
  103. currectData:{
  104. },
  105. hoursList:[
  106. '00:00',
  107. '00:30',
  108. '01:00',
  109. '01:30',
  110. '02:00',
  111. '02:30',
  112. '03:00',
  113. '03:30',
  114. '04:00',
  115. '04:30',
  116. '05:00',
  117. '05:30',
  118. '06:00',
  119. '06:30',
  120. '07:00',
  121. '07:30',
  122. '08:00',
  123. '08:30',
  124. '09:00',
  125. '09:30',
  126. '10:00',
  127. '10:00',
  128. '11:00',
  129. '11:30',
  130. '12:00',
  131. '12:30',
  132. '13:00',
  133. '13:30',
  134. '14:00',
  135. '14:30',
  136. '15:00',
  137. '15:30',
  138. '16:00',
  139. '16:30',
  140. '17:00',
  141. '17:30',
  142. '18:00',
  143. '18:30',
  144. '19:00',
  145. '19:30',
  146. '20:00',
  147. '20:30',
  148. '21:00',
  149. '21:30',
  150. '22:00',
  151. '22:30',
  152. '23:00',
  153. '23:30',
  154. '24:00'],
  155. }
  156. },
  157. onLoad() {
  158. that = this
  159. },
  160. onShow(){
  161. if(uni.getStorageSync('myCateringdustry')){
  162. this.currectData=JSON.parse(uni.getStorageSync('myCateringdustry'))
  163. var start = 0,end = 0
  164. for(var i=0;i<this.hoursList.length;i++){
  165. if(this.currectData.startDate==this.hoursList[i]){
  166. start = i
  167. }
  168. if(this.currectData.endDate==this.hoursList[i]){
  169. end = i
  170. }
  171. }
  172. if(this.currectData.status=='显示中'){
  173. this.checked=true
  174. }else if(this.currectData.status=='已隐藏'){
  175. this.checked=false
  176. }
  177. if(this.currectData.lookFlag==0){
  178. this.checked1 =true
  179. }else{
  180. this.checked1 =false
  181. }
  182. this.time=[start,'0',end]
  183. console.log(this.time)
  184. }
  185. },
  186. methods: {
  187. change1(e){
  188. console.log(1111111)
  189. this.currectStatus = 2
  190. if(!this.checked1){
  191. this.content='确定禁止用户查看菜品价格?'
  192. this.isStatus = true
  193. }else{
  194. this.confirmStatusSubmit()
  195. }
  196. },
  197. toDetail(url){
  198. uni.navigateTo({
  199. url:url
  200. })
  201. },
  202. del(){
  203. this.isDel = true
  204. },
  205. change(e){
  206. this.currectStatus = 1
  207. console.log(e,this.checked)
  208. if(!this.checked){
  209. this.content='确定下架店铺?'
  210. this.isStatus = true
  211. }else{
  212. this.confirmStatusSubmit()
  213. }
  214. },
  215. confirmDelSubmit(){
  216. this.$request.baseRequest('admin.tourism.foodInfo', 'delete', {
  217. id: this.currectData.id
  218. }, failres => {
  219. uni.showToast({
  220. icon: "none",
  221. title: failres.errmsg,
  222. duration: 3000
  223. });
  224. uni.hideLoading()
  225. }).then(res => {
  226. uni.showToast({
  227. icon: "success",
  228. title: '删除成功',
  229. duration: 2000
  230. });
  231. this.isStatus = false
  232. uni.navigateBack()
  233. })
  234. },
  235. confirmStatusSubmit(){
  236. if(this.currectStatus==1){
  237. if(!this.checked){
  238. this.currectData.status='已隐藏'
  239. }else{
  240. this.currectData.status='显示中'
  241. }
  242. }else{
  243. if(!this.checked1){
  244. this.currectData.lookFlag=1
  245. }else{
  246. this.currectData.lookFlag=0
  247. }
  248. }
  249. this.$request.baseRequest('admin.tourism.foodInfo', 'update', {
  250. foodInfo: JSON.stringify(this.currectData)
  251. }, failres => {
  252. uni.showToast({
  253. icon: "none",
  254. title: failres.errmsg,
  255. duration: 3000
  256. });
  257. uni.hideLoading()
  258. }).then(res => {
  259. uni.showToast({
  260. icon: "success",
  261. title: this.currectStatus==1?this.checked?'店铺已上架':'店铺已下架':this.checked1?'开启成功':'关闭成功',
  262. duration: 2000
  263. });
  264. uni.setStorageSync('myCateringdustry',JSON.stringify(this.currectData))
  265. this.isStatus = false
  266. })
  267. },
  268. selectTime(){
  269. this.show = true
  270. },
  271. confrim(e){
  272. this.currectData.startDate=e.start
  273. this.currectData.endDate=e.end
  274. this.$request.baseRequest('admin.tourism.foodInfo', 'update', {
  275. foodInfo: JSON.stringify(this.currectData)
  276. }, failres => {
  277. uni.showToast({
  278. icon: "none",
  279. title: failres.errmsg,
  280. duration: 3000
  281. });
  282. uni.hideLoading()
  283. }).then(res => {
  284. uni.showToast({
  285. icon: "success",
  286. title: '修改营业时间成功',
  287. duration: 2000
  288. });
  289. this.show = false
  290. uni.setStorageSync('myCateringdustry',JSON.stringify(this.currectData))
  291. })
  292. },
  293. cancel(){
  294. this.show = false
  295. }
  296. }
  297. }
  298. </script>
  299. <style lang='scss' scoped>
  300. .title{
  301. padding:20rpx;
  302. font-weight:600;
  303. }
  304. </style>