index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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. uni.showModal({
  204. title: '提示',
  205. content: '确定删除店铺?',
  206. success (res) {
  207. if (res.confirm) {
  208. that.$u.debounce(confirmDelSubmit, 500)
  209. } else if (res.cancel) {
  210. console.log('用户点击取消')
  211. }
  212. }
  213. })
  214. },
  215. change(e){
  216. this.currectStatus = 1
  217. console.log(e,this.checked)
  218. if(!this.checked){
  219. this.content='确定下架店铺?'
  220. this.isStatus = true
  221. }else{
  222. this.confirmStatusSubmit()
  223. }
  224. },
  225. confirmDelSubmit(){
  226. this.$request.baseRequest('admin.tourism.foodInfo', 'delete', {
  227. id: this.currectData.id
  228. }, failres => {
  229. uni.showToast({
  230. icon: "none",
  231. title: failres.errmsg,
  232. duration: 3000
  233. });
  234. uni.hideLoading()
  235. }).then(res => {
  236. uni.showToast({
  237. icon: "success",
  238. title: '删除成功',
  239. duration: 2000
  240. });
  241. this.isStatus = false
  242. uni.navigateBack()
  243. })
  244. },
  245. confirmStatusSubmit(){
  246. if(this.currectStatus==1){
  247. if(!this.checked){
  248. this.currectData.status='已隐藏'
  249. }else{
  250. this.currectData.status='显示中'
  251. }
  252. }else{
  253. if(!this.checked1){
  254. this.currectData.lookFlag=1
  255. }else{
  256. this.currectData.lookFlag=0
  257. }
  258. }
  259. this.$request.baseRequest('admin.tourism.foodInfo', 'update', {
  260. foodInfo: JSON.stringify(this.currectData)
  261. }, failres => {
  262. uni.showToast({
  263. icon: "none",
  264. title: failres.errmsg,
  265. duration: 3000
  266. });
  267. uni.hideLoading()
  268. }).then(res => {
  269. uni.showToast({
  270. icon: "success",
  271. title: this.currectStatus==1?this.checked?'店铺已上架':'店铺已下架':this.checked1?'开启成功':'关闭成功',
  272. duration: 2000
  273. });
  274. uni.setStorageSync('myCateringdustry',JSON.stringify(this.currectData))
  275. this.isStatus = false
  276. })
  277. },
  278. selectTime(){
  279. this.show = true
  280. },
  281. confrim(e){
  282. this.currectData.startDate=e.start
  283. this.currectData.endDate=e.end
  284. this.$request.baseRequest('admin.tourism.foodInfo', 'update', {
  285. foodInfo: JSON.stringify(this.currectData)
  286. }, failres => {
  287. uni.showToast({
  288. icon: "none",
  289. title: failres.errmsg,
  290. duration: 3000
  291. });
  292. uni.hideLoading()
  293. }).then(res => {
  294. uni.showToast({
  295. icon: "success",
  296. title: '修改营业时间成功',
  297. duration: 2000
  298. });
  299. this.show = false
  300. uni.setStorageSync('myCateringdustry',JSON.stringify(this.currectData))
  301. })
  302. },
  303. cancel(){
  304. this.show = false
  305. }
  306. }
  307. }
  308. </script>
  309. <style lang='scss' scoped>
  310. .title{
  311. padding:20rpx;
  312. font-weight:600;
  313. }
  314. </style>