index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. <template>
  2. <view style="padding-bottom: 80upx">
  3. <view class="u-flex padding-lr bg padding-top">
  4. <view class="u-m-r-10">
  5. <image :src="avatar" style="width: 100rpx; height: 100rpx; border-radius: 100rpx" @click="goNav('/my/store/index')"></image>
  6. </view>
  7. <view class="u-flex-1 u-m-l-10" v-if="!isLogin">
  8. <view class="u-font-18 text-bold">
  9. <view class="margin-left-sm margin-top-xs">
  10. <view class="flex align-end" style="display: flex; align-items: center">
  11. {{ userName }}
  12. <view class="status" v-if="shop" @click="changePutaWayFlag">
  13. <image
  14. :src="shop.putawayFlag == 0 ? '../../static/images/index/shangban.png' : '../../static/images/index/dayang.png'"
  15. style="width: 54rpx; height: 54rpx"
  16. ></image>
  17. {{ shop.putawayFlag == 0 ? '营业' : '关门' }}
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <view v-else class="text-xl u-p-l-20 text-bold" @click="goLogin('/pages/my/loginphone')">登录</view>
  24. </view>
  25. <view class="flex align-center padding-left">
  26. <image src="../../static/images/img/data.png" style="width: 26upx; height: 26upx"></image>
  27. <view class="margin-left-xs flex align-center" style="color: #999999">
  28. <view @click="bindData(1)">{{ startTime ? startTime : '开始时间' }}</view>
  29. <view @click="bindData(2)">{{ endTime ? endTime : '结束时间' }}</view>
  30. </view>
  31. </view>
  32. <view class="flex align-center box justify-between text-center">
  33. <view @click="goNav('/my/other/cashList')">
  34. <text class="text-bold text-xl">{{ allMoney ? allMoney : '0' }}</text>
  35. <view>总收益</view>
  36. </view>
  37. <view class="">
  38. <text class="text-bold text-xl">{{ allCount ? allCount : '0' }}</text>
  39. <view>总销量</view>
  40. </view>
  41. <view @click="goNav('/my/store/pingjia')">
  42. <text class="text-bold text-xl">{{ countTakingByUserId ? countTakingByUserId : '0' }}</text>
  43. <view>用户评价</view>
  44. </view>
  45. <!-- <view class="">
  46. <text class="text-bold text-xl">{{putaway+soldOut}}</text>
  47. <view>用户发布</view>
  48. </view> -->
  49. </view>
  50. <view class="padding">
  51. <view class="text-bold text-lg margin-bottom-sm">订单数据</view>
  52. <view class="orderbox">
  53. <view class="">
  54. <text class="text-bold text-xl">{{ orderMoney ? orderMoney : '0' }}</text>
  55. <view class="margin-top-xs">订单收入</view>
  56. </view>
  57. <view class="">
  58. <text class="text-bold text-xl">{{ sumCountOrder ? sumCountOrder : '0' }}</text>
  59. <view class="margin-top-xs">总订单数</view>
  60. </view>
  61. <view class="">
  62. <text class="text-bold text-xl">{{ refundMoney ? refundMoney : '0' }}</text>
  63. <view class="margin-top-xs">退款金额</view>
  64. </view>
  65. <view class="">
  66. <text class="text-bold text-xl">{{ countByUserId ? countByUserId : '0' }}</text>
  67. <view class="margin-top-xs">访客人数</view>
  68. </view>
  69. </view>
  70. </view>
  71. <view style="padding: 0upx 30upx">
  72. <view class="text-bold text-lg margin-bottom-sm flex justify-between">
  73. <view>订单管理</view>
  74. <view @click="goDetail(1)">
  75. <text style="color: #666666; font-size: 26upx; margin-right: 10upx">查看全部</text>
  76. <image src="../../static/images/my/right.png" style="width: 12upx; height: 20upx"></image>
  77. </view>
  78. </view>
  79. <view class="orderbox">
  80. <!-- <view class="">
  81. <text class="text-bold text-xl">{{i1}}</text>
  82. <view class="margin-top-xs">待付款</view>
  83. </view> -->
  84. <view class="">
  85. <text class="text-bold text-xl">{{ i5 }}</text>
  86. <view class="margin-top-xs">待接单</view>
  87. </view>
  88. <view class="">
  89. <text class="text-bold text-xl">{{ i2 }}</text>
  90. <view class="margin-top-xs">制作中</view>
  91. </view>
  92. <view class="">
  93. <text class="text-bold text-xl">{{ i3 }}</text>
  94. <view class="margin-top-xs">待取餐</view>
  95. </view>
  96. <view class="">
  97. <text class="text-bold text-xl">{{ i4 }}</text>
  98. <view class="margin-top-xs">已完成</view>
  99. </view>
  100. </view>
  101. </view>
  102. <view class="padding">
  103. <view class="text-bold text-lg margin-bottom-sm flex justify-between">
  104. <view>我的商品</view>
  105. <view @click="goDetail(2)">
  106. <text style="color: #666666; font-size: 26upx; margin-right: 10upx">查看全部</text>
  107. <image src="../../static/images/my/right.png" style="width: 12upx; height: 20upx"></image>
  108. </view>
  109. </view>
  110. <view class="orderbox">
  111. <view class="">
  112. <text class="text-bold text-xl">{{ putawayCount }}</text>
  113. <view class="margin-top-sm">上架中</view>
  114. </view>
  115. <view class="">
  116. <text class="text-bold text-xl">{{ soldoutCount }}</text>
  117. <view class="margin-top-sm">已下架</view>
  118. </view>
  119. <view @click="bindFb()">
  120. <image src="../../static/images/index/add.png" style="width: 46upx; height: 46upx"></image>
  121. <view class="margin-top-xs">添加商品</view>
  122. </view>
  123. </view>
  124. </view>
  125. <u-popup v-model="Authorization" mode="center" close-icon="close-circle" close-icon-pos="top-right" close-icon-color="#8f9298" close-icon-size="50">
  126. <view class="contentview">
  127. <view class="title">隐私保护指引</view>
  128. <view class="des" @click="openPrivacyContract">
  129. 在使用当前小程序服务之前,请仔细阅读
  130. <text style="color: #ff7f00">{{ privacyContractName }}</text>
  131. 。如你同意{{ privacyContractName }},请点击“同意”开始使用。
  132. </view>
  133. <view class="btns">
  134. <button class="item reject" @click="exitMiniProgram">拒绝</button>
  135. <button id="agree-btn" class="item agree" open-type="agreePrivacyAuthorization" @agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
  136. </view>
  137. </view>
  138. </u-popup>
  139. <!-- 开始时间 -->
  140. <u-picker v-model="startshow" mode="time" :params="paramsStart" @confirm="startData"></u-picker>
  141. <!-- 结束时间 -->
  142. <u-picker v-model="endshow" mode="time" :params="paramsEnd" @confirm="endData"></u-picker>
  143. </view>
  144. </template>
  145. <script>
  146. import { encrypt, decrypt, urlSafeBase64Decode, urlSafeBase64Encode } from '@/utils/cryptojs.js'
  147. export default {
  148. data() {
  149. return {
  150. Authorization: false,
  151. privacyContractName: '',
  152. avatar: '../../static/logo.png',
  153. isLogin: true,
  154. userName: '匿名',
  155. startshow: false,
  156. endshow: false,
  157. paramsStart: {
  158. year: true,
  159. month: true,
  160. day: true,
  161. hour: false,
  162. minute: false,
  163. second: false
  164. },
  165. paramsEnd: {
  166. year: true,
  167. month: true,
  168. day: true,
  169. hour: false,
  170. minute: false,
  171. second: false
  172. },
  173. startTime: '',
  174. endTime: '',
  175. allMoney: 0, //总收益
  176. allCount: 0, //总销量
  177. countTakingByUserId: 0, //用户评价数
  178. orderMoney: 0, //订单收入
  179. sumCountOrder: 0, //总订单数
  180. refundMoney: 0, //退款金额
  181. countByUserId: 0, //访客人数
  182. i1: 0, //待付款
  183. i2: 0, //制作中
  184. i3: 0, //待取餐
  185. i4: 0, //已完成
  186. i5: 0, //商家待接单
  187. putawayCount: 0, //上架中
  188. soldoutCount: 0, //下架中
  189. page: 1,
  190. limit: 10,
  191. longitude: '',
  192. latitude: '',
  193. userId: '',
  194. shop: '',
  195. arr: [],
  196. errCount: 0,
  197. messageConfiguration: ''
  198. }
  199. },
  200. onLoad() {
  201. // var acc =
  202. // 'RPX3_v1bTP4fLfrEMWHegBp_pJPh8TGDaN-SHZFjyyLqGa-M1P5IeNfVbwxsukpWmYVQnDU3hQz3dAT3wF-S58dfh0vXozVsynPq0q9mXA32nGETzt0VpJ4pbU1udcK8ia5M22RV2sF64vbGNxf9VuNTmIy3rqK-l3JwtbCGw94CcfTC6env4sMd35pkeTV2haSeHz3qGRc_TCf2yNewmyfPz_Z11Jmhe_PzAND9IkqT3KBo9JusvkFlR9MfelT9IJHHylGHEu60OIBf2rsQZmkJRwbBiDw_i1yawM2aJRVs9u0CB1nCtjh4Ce_VyJomDK9qrnrwwsGuwGOdxvTdE56oDK-vbigd7ui4Q1t-qrspkZaOvFqs9xX0ye9CVB3vPBxkVjV5vK84jyUZzzWBnn93SzyS5pTl1WfR8AQx_TEg-YE9B4i0A-R8yp3syXGR4piK5faFAnmYTc9sHYDPLjahe1Fkd0SpLTMD3ELa_eObMHmvRe7oKVjBUg6oDGtw-pi1y-WbzD3yW6fGZugXulmUHDVHuXVhL4dTYqwK_iVmHJhCmX81lgETrqgsScvyK5KM-2SJD8ftrLuuewWqwO0O5sBPxQ9T2fG-Sm0JcBN3_J1A9dLo-aQtY7IZW1cNj7gSDsSAEPUAc8gTgyqVeAM6_ftzuN7EzPcIau7979js0hoblrHa8kZFvJgRzilBnH2xOPTbHCLhXsvwErGGyQ5WHo7xSmFUyvsPGWLJXJqBsq7j9X9pYa-uRpFwbJPgV_ylSuTIkoxdpqe8tmIP3dWIyngschDIh8Y9XCJNQO0yaZMkdfmV-DU0TX2duJSg9B6lZ51ZwBJ_aBjtTOJnlL3CGwPDj3WFACm28lSjczfjrmQcnIhTiNl8RY1RKzbuWL700QsNreGkoZ_W-m7udFw-J_ed9iJBaAGfVzAMmGXp9hEKZI4n9nXAUCQdDCC5gxc16MM9b8aCGfcbA4Ht4cT4xXj7GuNXbXDwtIPyzu_mdv7y8aXKCwExrMIaplK6RUlZHeBp0Be8rlWJXz3xcd6sJ28js6aUcn61NzZked9pYHDT62edeiabT3z0J-iAnEhmZgT1LNtg7qt3tluulNaRzeoIK5X2JS71JRcM_-QuukajDC1OKja4GDzIDoW0huJYxJsEb0qn924_9ixc8yGYCzVG4swn_Tj5SMhLXgt44aGETdQa5SiSKuG3kuUiYpPnJ0vjNm5BjcSfL1CyI-Xp2S_QGKB6HQkwbLW7fuL_sI82iJUAtLOJrLnKCpPDm-v_yF3G3L7nDtRtoIxsaTLxVB-jErUK5WGWi3dAJXdvlLhRAL3MYnTdQret94G9jXvQtA7vv656AV-5DHSWBIwtnn-KDrtwQaiauR6459Y86vFBEAD873Fslo6O8ffO2D3qD6DPbVguN3gbMpD-X2rNlbdAOVHWI6x5mZOi8RS6BAp_yTXFweKJeWicVTo7s3UiuvYLbszQSWsbVMppN1AgzKiyshVentFYJdvRc2ZL7g1KcYtdQgx2FGFjYN2uE7PuU8WbpKzmZpmwZheHZjnbVnVg_SIC0NU9R0ji-61dqe_DT7r4hjNI-1msDiOHvrVNF0UJGGfq8DXob6UYkVoSX2R7z4N3Kg6iXJ83nGFjyO2XNky2KtsrlDrIB3gpqn4TzRh9-UmQRTGFCfx_02pKvTbRId08khAh7Xs9BypBrtcls9bFsvgVRdWCgEGX7OpX9sXh5z4NbBtPOlIn4-xBoXFUV53M04mwoh0N9RLoLQKAt0VD3bhMTK0ApRDh09RfOqVJaXkdwTtGBbNeJMrvibtbjiYnhf8aGrmyX6eN-huJlkXkTMB6eZmRyiLKEdO-gtXCRJQsCorPWyrT4EgnW0JL8z8A5skxBfvcoMScC0Mtd9Vk9wYxLXvKO6VXrZyvNon7juCwlck7qtwqojWZ6vf39aZsLhS-UNXJKmucj_Y7I9iwRNZtoDYOrWTiyRq4nOAmpQDqpMxJlfzM2HSFd-JNqGEIcYt7iHNsNJdUZZ_iuM0yGHY8dTaw8zhMY-TI5H2hG5UCKvnxE0cBXCqZHzO0RcEM7WzMRxgGq_4a4Hg949gv07OS8CbscyG_YqyF1Tvy08YyT0-jW2dkLkJ2v2NZv0PxXs4XK8PaPkXidCxiNVHrBQPwjkgSMa8SARzfwmaM5BDeM1Ww4h_unHitp5If6I-oHKIlsJ-PzGqCg6mowKjSP4yfQfYa_BMc29bXsfzOR9xGNGvREm4WvcuzDHNlInJxKwJTTE0tQ0kdG-t6za5-Ix5Hk-oi3PfZPO7T3jcYSMe8KrKYmQnjCkvL3V4M511EljXF1uEgdVGnmmmsMYhfB7fgj6gM-OAdgsNacB5Wn-ti_dMF0PHIyHtdRtpHGjruxahaa-NKIFYDk5AX59aZbwfNfXNQsbiDBrMEGMZy3g5d40W9Le_PGxOKAw4IISvkbePFA3Zd5gqC0RXCjhjwuHLaAS9NxTDDAPZj7TKu7j3qNLRBQhQibnWJoNDxpi1a439uI4byCqwnNMd13uKuwoJdjsOEqi8ZNcACjFna9YAMsy5yFKB61BrguxPt-fIUS7I4enmxL73dfSFkts9e6KJCpA2B5oIaJTCz-gtixD2vBG1MMej9Xm6ND-zAJbHW5CzfFCYVXrMhs-0wVqCbEoPbc12Iyp6VVnqF9b7QVBnPElYWZkOHWaDR5w1U7asg2ezj7P2zk38jN5NvtziYqSzcwY2naryNZmtq5YhfXv87bjVtWtbrI07XcBqAs90L9qLdKWbBzGo='
  203. console.log('加密ww', urlSafeBase64Encode(encrypt('1')))
  204. console.log('解密', decrypt(urlSafeBase64Decode('RnmM9Lfr_f0bCsUbdWOYRT20lNStqGNuOsC-8mdHxL3PwJhB8i1_l9nJaslFxYrE3W7noKXVqmbHRlvRqmynBQ==')), 'll')
  205. this.userId = uni.getStorageSync('userId')
  206. if (this.userId) {
  207. this.getFb()
  208. }
  209. this.$Request.getT('/app/common/type/354').then((res) => {
  210. //订单取消通知
  211. if (res.code == 0) {
  212. if (res.data && res.data.value) {
  213. this.arr.push(res.data.value)
  214. }
  215. }
  216. })
  217. this.$Request.getT('/app/common/type/353').then((res) => {
  218. //订单取消通知
  219. if (res.code == 0) {
  220. if (res.data && res.data.value) {
  221. this.arr.push(res.data.value)
  222. }
  223. }
  224. })
  225. this.$Request.getT('/app/common/type/352').then((res) => {
  226. //新订单通知
  227. if (res.code == 0) {
  228. if (res.data && res.data.value) {
  229. this.arr.push(res.data.value)
  230. }
  231. }
  232. })
  233. // #ifdef MP-WEIXIN
  234. try {
  235. let that = this
  236. wx.getPrivacySetting({
  237. success: (res) => {
  238. console.log('是否需要授权:', res.needAuthorization, '隐私协议的名称为:', res.privacyContractName)
  239. if (res.needAuthorization) {
  240. that.privacyContractName = res.privacyContractName
  241. // this.$refs.popusAuthorization.open();
  242. that.Authorization = true
  243. }
  244. },
  245. fail: () => {},
  246. complete: () => {}
  247. })
  248. } catch (e) {
  249. //TODO handle the exception
  250. }
  251. // #endif
  252. },
  253. onShow() {
  254. this.userId = uni.getStorageSync('userId')
  255. if (this.userId) {
  256. this.isLogin = false
  257. this.getUserInfo()
  258. this.getFb()
  259. // this.getTodayOrder()
  260. this.getcity()
  261. this.getShopInfo()
  262. // #ifdef MP-WEIXIN
  263. //订阅
  264. if (!uni.getStorageSync('sendindexMsg')) {
  265. this.openMsg()
  266. }
  267. // #endif
  268. this.getSetData()
  269. } else {
  270. this.isLogin = true
  271. // this.userName = '匿名'
  272. this.avatar = '../../static/logo.png'
  273. this.allMoney = 0 //总收益
  274. this.putawayCount = 0 //上架中
  275. this.soldoutCount = 0 //下架中
  276. this.allCount = 0 //总销量
  277. this.countTakingByUserId = 0 //用户评价
  278. this.orderMoney = 0 //订单收入
  279. this.sumCountOrder = 0 //总订单数
  280. this.refundMoney = 0 //退款金额
  281. this.countByUserId = 0 //访客人数
  282. this.i1 = 0 //待付款
  283. this.i3 = 0 //待取餐
  284. this.i2 = 0 //制作中
  285. this.i4 = 0 //已完成
  286. this.i5 = 0 //商家待接单
  287. }
  288. let that = this
  289. if (that.userId) {
  290. if (this.messageConfiguration == 1) {
  291. setInterval(function () {
  292. // 订单消息提醒
  293. // newsSelect() {
  294. let data = {
  295. shopIds: that.$queue.getData('shopId')
  296. }
  297. that.$Request.post('/admin/ordermessage/selectReadFlagCount', data).then((res) => {
  298. if (res.code === 0) {
  299. // that.errCount = res.data
  300. if (res.data > 0) {
  301. if (that.errCount != res.data) {
  302. that.errCount = res.data
  303. that.aplayAudio()
  304. uni.showModal({
  305. title: '消息',
  306. content: '有' + res.data + '条订单,请前往订单中心处理。',
  307. success: (ret) => {
  308. if (ret.confirm) {
  309. uni.switchTab({
  310. url: '/pages/order/index'
  311. })
  312. } else {
  313. console.log('else', ret)
  314. that.defineCallBack()
  315. }
  316. }
  317. })
  318. // this.chatNum = data.data
  319. }
  320. } else {
  321. that.errCount = 0
  322. }
  323. }
  324. })
  325. }, 10000)
  326. }
  327. }
  328. },
  329. methods: {
  330. getSetData() {
  331. // 获取订阅消息配置
  332. let data = {
  333. shopId: uni.getStorageSync('shopId')
  334. }
  335. this.$Request.getT('/app/goods/selectGoodShop', data).then((res) => {
  336. if (res.code == 0) {
  337. this.messageConfiguration = res.data.messageConfiguration
  338. }
  339. })
  340. },
  341. // 打开隐私协议页面
  342. openPrivacyContract() {
  343. let that = this
  344. wx.openPrivacyContract({
  345. fail: () => {
  346. that.$queue.showToast('遇到错误无法打开!')
  347. }
  348. })
  349. },
  350. // 拒绝隐私协议
  351. exitMiniProgram() {
  352. // 直接退出小程序
  353. wx.exitMiniProgram()
  354. },
  355. // 同意隐私协议
  356. handleAgreePrivacyAuthorization() {
  357. this.Authorization = false
  358. },
  359. openMsg() {
  360. var that = this
  361. wx.getSetting({
  362. withSubscriptions: true, //是否获取用户订阅消息的订阅状态,默认false不返回
  363. success(ret) {
  364. if (ret.subscriptionsSetting.itemSettings) {
  365. uni.setStorageSync('sendindexMsg', true)
  366. uni.openSetting({
  367. // 打开设置页
  368. success(rea) {
  369. console.log(rea.authSetting)
  370. }
  371. })
  372. } else {
  373. // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
  374. uni.setStorageSync('sendindexMsg', false)
  375. uni.showModal({
  376. title: '提示',
  377. content: '为了更好的体验,请绑定消息推送',
  378. confirmText: '确定',
  379. cancelText: '取消',
  380. success: function (res) {
  381. if (res.confirm) {
  382. uni.requestSubscribeMessage({
  383. tmplIds: that.arr,
  384. success(re) {
  385. // console.log(re,'**********')
  386. var datas = JSON.stringify(re)
  387. if (datas.indexOf('accept') != -1) {
  388. console.log(re)
  389. }
  390. },
  391. fail: (res) => {
  392. console.log(res)
  393. }
  394. })
  395. that.showModal = false
  396. } else if (res.cancel) {
  397. that.showModal = true
  398. }
  399. }
  400. })
  401. }
  402. }
  403. })
  404. },
  405. //切换店铺状态
  406. changePutaWayFlag() {
  407. if (this.shop.putawayFlag == 0) {
  408. uni.showModal({
  409. title: '提示',
  410. content: '确定要打烊了吗?',
  411. showCancel: true,
  412. cancelText: '取消',
  413. confirmText: '确定',
  414. success: (res) => {
  415. if (res.confirm) {
  416. this.shop.putawayFlag = 1
  417. this.updateShopInfo()
  418. }
  419. },
  420. fail: () => {},
  421. complete: () => {}
  422. })
  423. } else {
  424. this.shop.putawayFlag = 0
  425. this.updateShopInfo()
  426. }
  427. },
  428. updateShopInfo() {
  429. this.$Request.postJsonA('/app/shop/updateShopMessage', this.shop).then((res) => {
  430. if (res.code == 0) {
  431. this.getShopInfo()
  432. } else {
  433. // this.shop.putawayFlag = 1
  434. uni.showModal({
  435. title: '提示',
  436. content: res.msg,
  437. success: function (res) {
  438. if (res.confirm) {
  439. } else if (res.cancel) {
  440. }
  441. }
  442. })
  443. this.getShopInfo()
  444. }
  445. })
  446. },
  447. getShopInfo() {
  448. if (this.$queue.getData('shopId')) {
  449. let data = {
  450. shopId: this.$queue.getData('shopId')
  451. }
  452. this.$Request.getA('/app/shop/selectShopMessage', data).then((res) => {
  453. if (res.code == 0) {
  454. uni.hideLoading()
  455. this.shop = res.data
  456. }
  457. })
  458. }
  459. },
  460. aplayAudio() {
  461. // const audio = document.getElementById('audio')
  462. // audio.play()
  463. // console.log('语音提示')
  464. const innerAudioContext = uni.createInnerAudioContext()
  465. innerAudioContext.autoplay = true
  466. // innerAudioContext.src ='../../static/mpc/order.mp3';
  467. innerAudioContext.src = 'https://pw.xianmxkj.com/file/uploadPath/2022/01/19/0753211f78d718d44ee6372e33eae9ee.mp3'
  468. innerAudioContext.onPlay(() => {
  469. console.log('开始播放')
  470. })
  471. innerAudioContext.onError((res) => {
  472. console.log(res.errMsg)
  473. console.log(res.errCode)
  474. })
  475. },
  476. defineCallBack() {
  477. let that = this
  478. let data = {
  479. shopIds: that.$queue.getData('shopId')
  480. }
  481. that.$Request.post('/admin/ordermessage/allcheckOrderMessage', data).then((res) => {
  482. if (res.code === 0) {
  483. that.errCount = 0
  484. }
  485. })
  486. },
  487. getcity() {
  488. let that = this
  489. uni.getLocation({
  490. type: 'wgs84',
  491. success: function (res) {
  492. // console.log('当前位置的经度:' + res.longitude);
  493. // console.log('当前位置的纬度:' + res.latitude);
  494. that.latitude = res.latitude
  495. that.longitude = res.longitude
  496. }
  497. })
  498. },
  499. //获取用户发布
  500. getFb() {
  501. let data = {
  502. startTime: this.startTime,
  503. endTime: this.endTime,
  504. shopId: this.$queue.getData('shopId')
  505. }
  506. this.$Request.getA('/app/shop/shopHomePage', data).then((res) => {
  507. if (res.code == 0) {
  508. this.allMoney = res.data.allMoney //总收益
  509. this.putawayCount = res.data.putawayCount //上架中
  510. this.soldoutCount = res.data.soldoutCount //下架中
  511. this.allCount = res.data.allCount //总销量
  512. this.countTakingByUserId = res.data.countTakingByUserId //用户评价
  513. this.orderMoney = res.data.orderMoney //订单收入
  514. this.sumCountOrder = res.data.sumCountOrder //总订单数
  515. this.refundMoney = res.data.refundMoney //退款金额
  516. this.countByUserId = res.data.countByUserId //访客人数
  517. this.i1 = res.data.i1 //待付款
  518. this.i3 = res.data.i3 //待取餐
  519. this.i2 = res.data.i2 //制作中
  520. this.i4 = res.data.i4 //已完成
  521. this.i5 = res.data.i5 //商家待接单
  522. }
  523. })
  524. },
  525. goDetail(index) {
  526. // #ifdef MP-WEIXIN
  527. if (uni.getStorageSync('sendindexMsg')) {
  528. uni.requestSubscribeMessage({
  529. tmplIds: this.arr,
  530. success(re) {
  531. // console.log(re,'**********')
  532. var datas = JSON.stringify(re)
  533. if (datas.indexOf('accept') != -1) {
  534. console.log(re)
  535. }
  536. },
  537. fail: (res) => {
  538. console.log(res)
  539. }
  540. })
  541. }
  542. // #endif
  543. if (index == 1) {
  544. uni.switchTab({
  545. url: '/pages/order/index'
  546. })
  547. } else if (index == 2) {
  548. uni.navigateTo({
  549. url: '/my/store/addgood'
  550. })
  551. }
  552. },
  553. bindFb() {
  554. let userId = uni.getStorageSync('userId')
  555. if (userId) {
  556. uni.navigateTo({
  557. url: '/my/publish/goods'
  558. })
  559. } else {
  560. uni.showModal({
  561. title: '提示',
  562. content: '您还未登录,请先登录',
  563. success: function (res) {
  564. if (res.confirm) {
  565. // console.log('用户点击确定');
  566. uni.navigateTo({
  567. url: '/pages/my/loginphone'
  568. })
  569. } else if (res.cancel) {
  570. // console.log('用户点击取消');
  571. }
  572. }
  573. })
  574. }
  575. },
  576. //时间弹框开关
  577. bindData(index) {
  578. if (index == 1) {
  579. this.startshow = true
  580. } else if (index == 2) {
  581. this.endshow = true
  582. }
  583. },
  584. //开始时间
  585. startData(e) {
  586. this.startTime = e.year + '-' + e.month + '-' + e.day
  587. },
  588. // 结束时间
  589. endData(e) {
  590. this.endTime = e.year + '-' + e.month + '-' + e.day
  591. this.getFb()
  592. },
  593. goNav(e, name) {
  594. if (this.userId) {
  595. // #ifdef MP-WEIXIN
  596. if (uni.getStorageSync('sendindexMsg')) {
  597. uni.requestSubscribeMessage({
  598. tmplIds: this.arr,
  599. success(re) {
  600. // console.log(re,'**********')
  601. var datas = JSON.stringify(re)
  602. if (datas.indexOf('accept') != -1) {
  603. console.log(re)
  604. }
  605. },
  606. fail: (res) => {
  607. console.log(res)
  608. }
  609. })
  610. }
  611. // #endif
  612. uni.navigateTo({
  613. url: e
  614. })
  615. } else {
  616. uni.showModal({
  617. title: '提示',
  618. content: '您还未登录,请先登录',
  619. success: function (res) {
  620. if (res.confirm) {
  621. console.log('用户点击确定')
  622. uni.navigateTo({
  623. url: '/pages/my/loginphone'
  624. })
  625. } else if (res.cancel) {
  626. console.log('用户点击取消')
  627. }
  628. }
  629. })
  630. }
  631. },
  632. getUserInfo() {
  633. console.log(',,,')
  634. this.$Request.getA('/sys/user/info').then((res) => {
  635. console.log(res, 'kk')
  636. if (res.code == 0) {
  637. // this.userName = res.user.userEntity.userName
  638. this.userName = res.user.shopList[0].shopName
  639. // this.avatar = res.user.userEntity.avatar ? res.user.userEntity.avatar : '../../static/logo.png'
  640. this.avatar = res.user.shopList[0].shopCover ? res.user.shopList[0].shopCover : '../../static/logo.png'
  641. this.$queue.setData('userId', res.user.userId)
  642. this.$queue.setData('shopId', res.user.shopList[0].shopId)
  643. this.$queue.setData('mobile', res.user.mobile)
  644. if (res.user.userEntity) {
  645. this.$queue.setData('shopUserName', res.user.userEntity.userName)
  646. }
  647. }
  648. })
  649. },
  650. goLogin(e) {
  651. uni.navigateTo({
  652. url: e
  653. })
  654. }
  655. }
  656. }
  657. </script>
  658. <style lang="scss">
  659. page {
  660. background-color: #ffffff;
  661. }
  662. .bg {
  663. background-color: #ffffff;
  664. }
  665. .box {
  666. width: 690upx;
  667. margin: 0 auto;
  668. height: 120rpx;
  669. background: rgba(255, 141, 26, 0.6);
  670. border-radius: 16upx 16upx 0px 0px;
  671. color: #333333;
  672. padding: 0upx 30upx;
  673. margin-top: 20upx;
  674. }
  675. .orderbox {
  676. width: 690upx;
  677. margin: 0 auto;
  678. height: 153upx;
  679. background: #fafafa;
  680. border-radius: 16upx;
  681. display: flex;
  682. align-items: center;
  683. justify-content: space-between;
  684. text-align: center;
  685. padding: 0upx 30upx;
  686. }
  687. .privacy {
  688. position: fixed;
  689. top: 0;
  690. right: 0;
  691. bottom: 0;
  692. left: 0;
  693. background: rgba(0, 0, 0, 0.5);
  694. z-index: 9999999;
  695. display: flex;
  696. align-items: center;
  697. justify-content: center;
  698. }
  699. .contentview {
  700. width: 632rpx;
  701. padding: 48rpx;
  702. box-sizing: border-box;
  703. background: #fff;
  704. border-radius: 16rpx;
  705. }
  706. .contentview .title {
  707. text-align: center;
  708. color: #333;
  709. font-weight: bold;
  710. font-size: 32rpx;
  711. }
  712. .contentview .des {
  713. font-size: 26rpx;
  714. color: #666;
  715. margin-top: 40rpx;
  716. text-align: justify;
  717. line-height: 1.6;
  718. }
  719. .contentview .des .link {
  720. color: #07c160;
  721. text-decoration: underline;
  722. }
  723. button::after {
  724. border: none;
  725. }
  726. .btns {
  727. margin-top: 48rpx;
  728. display: flex;
  729. }
  730. .btns .item {
  731. justify-content: space-between;
  732. width: 244rpx;
  733. height: 80rpx;
  734. display: flex;
  735. align-items: center;
  736. justify-content: center;
  737. border-radius: 16rpx;
  738. box-sizing: border-box;
  739. border: none;
  740. }
  741. .btns .reject {
  742. background: #f4f4f5;
  743. color: #909399;
  744. }
  745. .btns .agree {
  746. background: #07c160;
  747. color: #fff;
  748. }
  749. .status {
  750. display: flex;
  751. justify-content: space-evenly;
  752. align-items: center;
  753. margin-left: auto;
  754. width: 215rpx;
  755. height: 93rpx;
  756. border: 2rpx solid #0061ff;
  757. border-radius: 10rpx;
  758. }
  759. </style>