index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. <template>
  2. <!-- pages/shopInfo/index.wxml -->
  3. <view class="container">
  4. <!-- 个人信息 -->
  5. <view class="userInfo">
  6. <view class="info">
  7. <view class="info_l">
  8. <view class="thumb_wrap">
  9. <image class="thumb" :src="imgUrl + info.thumb"></image>
  10. </view>
  11. <view class="name_wrap">
  12. <view class="name">{{ info.title }}</view>
  13. <view class="tel">{{ info.phone }}</view>
  14. </view>
  15. </view>
  16. <view class="tag" @tap="goMyIndex">普通用户</view>
  17. </view>
  18. <!-- 小圆圈 -->
  19. <view class="square"></view>
  20. </view>
  21. <!-- 弧度背景 -->
  22. <image class="bg" src="/static/statics/img/user/bg.png"></image>
  23. <!-- 账户余额 -->
  24. <view class="item firstItem">
  25. <view class="item_l">
  26. <view class="title">账户余额</view>
  27. <view class="cash">
  28. <view class="cash_tag">¥</view>
  29. <view class="cash_num">{{ info.money }}</view>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 门店状态 -->
  34. <view class="item">
  35. <view class="item_l">
  36. <view class="title">门店状态</view>
  37. </view>
  38. <view class="item_r">
  39. <van-radio-group :value="status" direction="horizontal" @change="onChangeSell" class="radioGroup">
  40. <van-radio :name="1" checked-color="#295C56" :class="status == 1 ? '' : 'unactive'">营业</van-radio>
  41. <van-radio :name="0" checked-color="#295C56" :class="status == 0 ? '' : 'unactive'">未营业</van-radio>
  42. </van-radio-group>
  43. </view>
  44. </view>
  45. <!-- 营业时间 -->
  46. <view class="item" @tap="goBusinessTime">
  47. <view class="item_l">
  48. <view class="title">营业时间</view>
  49. </view>
  50. <view class="item_r">
  51. <van-icon name="arrow" />
  52. </view>
  53. <!-- <view class="item_r flex">
  54. <view class="time" bindtap="beginTimeFun">{{ begin_at }}</view>
  55. <view class="line"></view>
  56. <view class="time" bindtap="endTimeFun">{{ end_at }}</view>
  57. </view> -->
  58. </view>
  59. <!-- 是否允许自提 -->
  60. <view class="item">
  61. <view class="item_l">
  62. <view class="title">是否允许自提</view>
  63. </view>
  64. <view class="item_r">
  65. <van-radio-group :value="is_ziti" direction="horizontal" @change="onChangeZiti" class="radioGroup">
  66. <van-radio :name="1" checked-color="#295C56" :class="is_ziti == 1 ? '' : 'unactive'">是</van-radio>
  67. <van-radio :name="0" checked-color="#295C56" :class="is_ziti == 0 ? '' : 'unactive'">否</van-radio>
  68. </van-radio-group>
  69. </view>
  70. </view>
  71. <!-- 是否允许配送 -->
  72. <view class="item">
  73. <view class="item_l">
  74. <view class="title">是否允许配送</view>
  75. </view>
  76. <view class="item_r">
  77. <van-radio-group :value="is_delivery" direction="horizontal" @change="onChangeDelivery" class="radioGroup">
  78. <van-radio :name="1" checked-color="#295C56" :class="is_delivery == 1 ? '' : 'unactive'">是</van-radio>
  79. <van-radio :name="0" checked-color="#295C56" :class="is_delivery == 0 ? '' : 'unactive'">否</van-radio>
  80. </van-radio-group>
  81. </view>
  82. </view>
  83. <!-- 提现 -->
  84. <view class="item" @tap="goCashOut">
  85. <view class="item_l">
  86. <view class="title">提现</view>
  87. </view>
  88. <view class="item_r">
  89. <van-icon name="arrow" />
  90. </view>
  91. </view>
  92. <!-- 提现记录 -->
  93. <view class="item" @tap="goCashOutlog">
  94. <view class="item_l">
  95. <view class="title">提现记录</view>
  96. </view>
  97. <view class="item_r">
  98. <van-icon name="arrow" />
  99. </view>
  100. </view>
  101. <!-- 门店外卖订单 -->
  102. <view class="item" @tap="goShopOrder" data-status="1">
  103. <view class="item_l">
  104. <view class="title">门店外卖订单</view>
  105. </view>
  106. <view class="item_r">
  107. <van-icon name="arrow" />
  108. </view>
  109. </view>
  110. <!-- 门店自提订单 -->
  111. <view class="item" @tap="goShopOrder" data-status="2">
  112. <view class="item_l">
  113. <view class="title">门店自提订单</view>
  114. </view>
  115. <view class="item_r">
  116. <van-icon name="arrow" />
  117. </view>
  118. </view>
  119. <!-- 优惠券使用情况 -->
  120. <view class="item" @tap="goShopCoupons">
  121. <view class="item_l">
  122. <view class="title">优惠券使用统计</view>
  123. </view>
  124. <view class="item_r">
  125. <van-icon name="arrow" />
  126. </view>
  127. </view>
  128. <!-- 开店时间 -->
  129. <van-popup :show="showBegin" position="bottom" @close="closeBeginTimePop">
  130. <van-datetime-picker type="time" title="选择开店时间" :value="currentBegin" @confirm="confirmBeginTime" @cancel="closeBeginTimePop" />
  131. </van-popup>
  132. <!-- 闭店时间 -->
  133. <van-popup :show="showEnd" position="bottom" @close="closeEndTimePop">
  134. <van-datetime-picker type="time" title="选择闭店时间" :value="currentEnd" @confirm="confirmEndTime" @cancel="closeEndTimePop" />
  135. </van-popup>
  136. </view>
  137. </template>
  138. <script>
  139. let myPro = require('../../../utils/wxRequest.js');
  140. let util = require('../../../utils/util.js');
  141. export default {
  142. data() {
  143. return {
  144. imgUrl: getApp().globalData.imgUrl,
  145. begin_at: '',
  146. end_at: '',
  147. status: 1,
  148. //
  149. is_ziti: 1,
  150. info: null,
  151. // 店铺详情
  152. showBegin: false,
  153. // 开店 时间pop
  154. currentBegin: '',
  155. showEnd: false,
  156. // 闭店 时间pop
  157. currentEnd: '',
  158. is_delivery: 1 // 1允许配送 0不允许
  159. };
  160. }
  161. /**
  162. * 生命周期函数--监听页面加载
  163. */,
  164. onLoad: function (options) {
  165. let that = this;
  166. },
  167. /**
  168. * 生命周期函数--监听页面初次渲染完成
  169. */
  170. onReady: function () {},
  171. /**
  172. * 生命周期函数--监听页面显示
  173. */
  174. onShow: function () {
  175. var that = this;
  176. that.getShopInfo();
  177. },
  178. /**
  179. * 生命周期函数--监听页面隐藏
  180. */
  181. onHide: function () {},
  182. /**
  183. * 生命周期函数--监听页面卸载
  184. */
  185. onUnload: function () {},
  186. /**
  187. * 页面相关事件处理函数--监听用户下拉动作
  188. */
  189. onPullDownRefresh: function () {},
  190. /**
  191. * 页面上拉触底事件的处理函数
  192. */
  193. onReachBottom: function () {},
  194. onPageScroll: function (event) {
  195. // Do something when page scroll
  196. },
  197. onResize: function () {
  198. // Do something when page resize
  199. },
  200. methods: {
  201. // 获取店铺信息
  202. getShopInfo() {
  203. let that = this;
  204. myPro
  205. .wxRequest('store/info', 'GET', {})
  206. .then((res) => {
  207. that.setData({
  208. info: res.result,
  209. begin_at: res.result.begin_at,
  210. end_at: res.result.end_at,
  211. status: res.result.status,
  212. is_ziti: res.result.is_ziti,
  213. is_delivery: res.result.is_delivery
  214. });
  215. })
  216. .catch((err) => {
  217. console.log('报错信息', err);
  218. uni.showToast({
  219. title: err,
  220. icon: 'none'
  221. });
  222. });
  223. },
  224. // 去个人资料
  225. goMyIndex() {
  226. uni.reLaunch({
  227. url: '/pages/user/index/index'
  228. });
  229. },
  230. // 是否营业
  231. onChangeSell(event) {
  232. let that = this;
  233. that.setData({
  234. status: event.detail
  235. });
  236. that.editShop();
  237. },
  238. // 是否自提
  239. onChangeZiti(event) {
  240. let that = this;
  241. that.setData({
  242. is_ziti: event.detail
  243. });
  244. that.editShop();
  245. },
  246. // 是否允许配送
  247. onChangeDelivery(event) {
  248. let that = this;
  249. that.setData({
  250. is_delivery: event.detail
  251. });
  252. that.editShop();
  253. },
  254. // 去门店订单
  255. goShopOrder(event) {
  256. let that = this;
  257. let status = event.currentTarget.dataset.status; // console.log('订单状态',event)
  258. uni.navigateTo({
  259. url: '/pages/shopRole/order/index?status=' + status
  260. });
  261. },
  262. // 开店时间
  263. beginTimeFun() {
  264. let that = this;
  265. that.setData({
  266. showBegin: true
  267. });
  268. },
  269. confirmBeginTime(event) {
  270. // console.log('开始时间',event)
  271. let that = this;
  272. that.setData({
  273. begin_at: event.detail,
  274. showBegin: false
  275. });
  276. that.editShop();
  277. },
  278. closeBeginTimePop() {
  279. let that = this;
  280. that.setData({
  281. showBegin: false
  282. });
  283. },
  284. // 闭店时间
  285. endTimeFun() {
  286. let that = this;
  287. that.setData({
  288. showEnd: true
  289. });
  290. },
  291. confirmEndTime(event) {
  292. // console.log('闭店时间',event)
  293. let that = this;
  294. that.setData({
  295. end_at: event.detail,
  296. showEnd: false
  297. });
  298. that.editShop();
  299. },
  300. closeEndTimePop() {
  301. let that = this;
  302. that.setData({
  303. showEnd: false
  304. });
  305. },
  306. // 编辑店铺信息
  307. editShop() {
  308. let that = this;
  309. let params = {
  310. status: that.status,
  311. is_ziti: that.is_ziti,
  312. begin_at: that.begin_at,
  313. end_at: that.end_at,
  314. is_delivery: that.is_delivery
  315. };
  316. myPro
  317. .wxRequest('store/editInfo', 'POST', params)
  318. .then((res) => {
  319. uni.showToast({
  320. title: res.msg,
  321. icon: 'none'
  322. }); // 重新获取详情
  323. that.getShopInfo();
  324. })
  325. .catch((err) => {
  326. console.log('报错信息', err);
  327. uni.showToast({
  328. title: err,
  329. icon: 'none'
  330. });
  331. });
  332. },
  333. // 提现
  334. goCashOut() {
  335. uni.navigateTo({
  336. url: '/pages/shopRole/cashout/index'
  337. });
  338. },
  339. // 提现记录
  340. goCashOutlog() {
  341. uni.navigateTo({
  342. url: '/pages/shopRole/cashoutlog/index'
  343. });
  344. },
  345. // 优惠券使用统计
  346. goShopCoupons() {
  347. let that = this;
  348. uni.navigateTo({
  349. url: '/pages/shopRole/usedcoupons/index'
  350. });
  351. },
  352. // 设置营业时间
  353. goBusinessTime() {
  354. let that = this;
  355. uni.navigateTo({
  356. url: '/pages/shopRole/businesstime/list/index'
  357. });
  358. }
  359. }
  360. };
  361. </script>
  362. <style>
  363. /* pages/shopInfo/index.wxss */
  364. /* 用户信息 */
  365. .userInfo {
  366. width: 100vw;
  367. height: 154rpx;
  368. background: #295c56;
  369. position: relative;
  370. }
  371. .info {
  372. padding-left: 40rpx;
  373. color: #ffffff;
  374. display: flex;
  375. align-items: center;
  376. justify-content: space-between;
  377. }
  378. .info_l {
  379. display: flex;
  380. align-items: center;
  381. }
  382. .thumb_wrap {
  383. width: 106rpx;
  384. height: 106rpx;
  385. background: rgba(255, 255, 255, 1);
  386. border-radius: 50%;
  387. position: relative;
  388. }
  389. .thumb {
  390. width: 100rpx;
  391. height: 100rpx;
  392. position: absolute;
  393. top: 50%;
  394. left: 50%;
  395. transform: translate(-50%, -50%);
  396. border-radius: 50%;
  397. }
  398. /* .thumb img{
  399. border-radius:50%;
  400. } */
  401. .icon_vip {
  402. width: 56rpx;
  403. height: 22rpx;
  404. position: absolute;
  405. top: 0;
  406. left: 100rpx;
  407. }
  408. .name_wrap {
  409. display: flex;
  410. flex-direction: column;
  411. /* align-items: center; */
  412. padding-left: 30rpx;
  413. width: 440rpx;
  414. }
  415. .name_wrap .name {
  416. font-size: 36rpx;
  417. width: 100%;
  418. white-space: nowrap;
  419. text-overflow: ellipsis;
  420. overflow: hidden;
  421. }
  422. .name_wrap .tel {
  423. font-size: 30rpx;
  424. /* padding-left: 20rpx; */
  425. }
  426. .name_wrap .van-icon-arrow {
  427. font-size: 30rpx;
  428. padding-left: 10rpx;
  429. }
  430. .tag {
  431. width: 130rpx;
  432. height: 45rpx;
  433. background: linear-gradient(-90deg, #295c56, rgba(255, 255, 255, 0.3));
  434. border-radius: 23rpx 0rpx 0rpx 23rpx;
  435. font-size: 28rpx;
  436. text-align: right;
  437. padding-right: 6rpx;
  438. line-height: 45rpx;
  439. color: #ffffff;
  440. }
  441. /* 充值 */
  442. .item {
  443. width: 690rpx;
  444. height: 100rpx;
  445. background: rgba(255, 255, 255, 1);
  446. box-shadow: 0rpx 0rpx 21rpx 0rpx rgba(0, 0, 0, 0.09);
  447. border-radius: 10rpx;
  448. margin: 30rpx auto 0;
  449. display: flex;
  450. align-items: center;
  451. justify-content: space-between;
  452. position: relative;
  453. }
  454. .item.firstItem {
  455. margin: -60rpx auto 0;
  456. }
  457. .item .item_l {
  458. padding-left: 44rpx;
  459. display: flex;
  460. }
  461. .item .title {
  462. font-size: 32rpx;
  463. color: rgba(0, 0, 0, 0.87);
  464. }
  465. .item .cash {
  466. color: rgba(213, 76, 67, 1);
  467. padding-left: 20rpx;
  468. font-size: 36rpx;
  469. display: flex;
  470. align-items: baseline;
  471. }
  472. .item .cash .cash_tag {
  473. font-size: 24rpx;
  474. padding-right: 8rpx;
  475. }
  476. .item .item_r {
  477. padding-right: 20rpx;
  478. }
  479. .item .item_r.flex {
  480. display: flex;
  481. align-items: center;
  482. }
  483. /* 单选框 */
  484. .radioGroup {
  485. display: flex;
  486. align-items: center;
  487. }
  488. .van-radio__label {
  489. margin-left: 10rpx !important;
  490. line-height: normal !important;
  491. font-size: 28rpx;
  492. color: rgba(0, 0, 0, 1);
  493. }
  494. .van-radio__icon {
  495. width: 40rpx !important;
  496. height: 40rpx !important;
  497. border: 0 none !important;
  498. background: rgba(238, 238, 238, 1);
  499. }
  500. .unactive .van-radio__label {
  501. color: rgba(0, 0, 0, 0.54);
  502. }
  503. .radioGroup .van-radio {
  504. margin-left: 20rpx;
  505. }
  506. /* 时间选择 */
  507. .time {
  508. width: 213rpx;
  509. height: 50rpx;
  510. background: rgba(255, 255, 255, 1);
  511. border: 1rpx solid rgba(0, 0, 0, 0.12);
  512. border-radius: 10rpx;
  513. text-align: center;
  514. color: rgba(89, 89, 89, 1);
  515. }
  516. /* .time{
  517. margin-left: 42rpx;
  518. }
  519. .time:first-of-type{
  520. margin-left: 0;
  521. } */
  522. .line {
  523. width: 18rpx;
  524. height: 2rpx;
  525. background: rgba(0, 0, 0, 0.12);
  526. margin: 0 12rpx;
  527. }
  528. /* 背景上的弧度 */
  529. .bg {
  530. width: 750rpx;
  531. height: 34rpx;
  532. display: block;
  533. }
  534. .square {
  535. content: '';
  536. display: block;
  537. width: 26rpx;
  538. height: 26rpx;
  539. background: rgba(255, 255, 255, 1);
  540. opacity: 0.1;
  541. border-radius: 50%;
  542. position: absolute;
  543. bottom: 120rpx;
  544. right: 120rpx;
  545. }
  546. /* */
  547. .container {
  548. padding-bottom: 30rpx;
  549. }
  550. </style>