setting.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <view>
  3. <!-- 设置 -->
  4. <u-card :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false"
  5. :show-head="false" @click="tishi">
  6. <view slot="body">
  7. <view class="u-flex u-row-between">
  8. <view class="">
  9. <u-image width="130rpx" height="130rpx" :src="userInfo.storeImageUrl" :lazy-load="true" shape="circle"
  10. :show-loading="true">
  11. <u-loading slot="loading"></u-loading>
  12. <view slot="error" style="font-size: 24rpx" :fade="true" duration="450">{{ $t('setUp.loadingFail') }}
  13. </view>
  14. </u-image>
  15. </view>
  16. <view class="u-flex">
  17. <!-- <view class="u-m-r-50" style="color: #0d79ec; font-size: 32rpx">修改门头照</view> -->
  18. <u-icon name="arrow-right" color="#0D79EC" size="28"></u-icon>
  19. </view>
  20. </view>
  21. </view>
  22. </u-card>
  23. <u-card :border="false" padding="20" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false"
  24. :show-head="false">
  25. <view slot="body">
  26. <template>
  27. <u-cell-group :border="false">
  28. <u-cell-item :title="$t('setUp.addressManagement')" @click="tishi">
  29. <u-icon slot="icon" size="42" name="location-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  30. </u-cell-item>
  31. <u-cell-item :title="$t('setUp.storeName')" :value="userInfo.storeName" :arrow="false">
  32. <u-icon slot="icon" size="42" name="shop-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  33. </u-cell-item>
  34. <u-cell-item :title="$t('setUp.storeContact')" :value="userInfo.contactName" :arrow="false">
  35. <u-icon slot="icon" size="42" name="contact" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  36. </u-cell-item>
  37. <u-cell-item :title="$t('setUp.mobile')" :value="userInfo.storePhone" :arrow="false">
  38. <u-icon slot="icon" size="42" name="phone-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  39. </u-cell-item>
  40. <u-cell-item :title="$t('setUp.agreement')" @click="openPdf(1)">
  41. <u-icon slot="icon" size="42" name="friends-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  42. </u-cell-item>
  43. <u-cell-item :title="$t('setUp.policy')" @click="openPdf(2)">
  44. <u-icon slot="icon" size="42" name="info-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  45. </u-cell-item>
  46. <u-cell-item :title="$t('setUp.version')" :value="edition_s" :value-style="customStyle" class="value-style" :arrow="false" :border-bottom="false" @click="edition">
  47. <u-icon slot="icon" size="42" name="setting-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  48. </u-cell-item>
  49. </u-cell-group>
  50. </template>
  51. </view>
  52. </u-card>
  53. <u-button type="primary" @click="exit" style="margin: 20rpx">{{ $t('setUp.exit') }}</u-button>
  54. <luo-version-upgrade v-if="show_s == true" :version="edition_s" :url="url" :is_force="is_force" :describe="Copywriting"></luo-version-upgrade>
  55. </view>
  56. </template>
  57. <script>
  58. import {
  59. mapMutations
  60. } from "vuex";
  61. import {
  62. request
  63. } from "../../../common/request/request";
  64. require("promise.prototype.finally").shim();
  65. export default {
  66. data() {
  67. return {
  68. userInfo: {},
  69. edition_s: '',
  70. show_s: false,
  71. url: '',
  72. is_force: false,
  73. Copywriting: '',
  74. customStyle: {
  75. color: '#0095FF'
  76. }
  77. };
  78. },
  79. created() {
  80. uni.setNavigationBarTitle({
  81. title: this.$t('setUp.title')
  82. });
  83. this.getMyinfo();
  84. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  85. //版本号
  86. this.edition_s = wgtinfo.version
  87. })
  88. },
  89. methods: {
  90. ...mapMutations(["logout"]),
  91. exit() {
  92. this.logout();
  93. this.$u.route({
  94. url: "pages/login/index",
  95. type: "reLaunch",
  96. });
  97. },
  98. openPdf(x) {
  99. if (x == 1) {
  100. this.$u.route({
  101. url: "pages/pdf/xy",
  102. });
  103. } else {
  104. this.$u.route({
  105. url: "pages/pdf/zc",
  106. });
  107. }
  108. },
  109. edition() {
  110. uni.getSystemInfo({
  111. success: res => {
  112. },
  113. complete: err => {
  114. if (err.platform == 'android') {
  115. this.onLaunch_s()
  116. } else if (err.platform == 'ios') {
  117. this.iosstartup()
  118. }
  119. }
  120. });
  121. },
  122. iosstartup() {
  123. request({
  124. url: '/baseReq/apkUpgrade',
  125. method: 'get',
  126. params: {
  127. osType: 1
  128. }
  129. }).then(res => {
  130. //最低版本
  131. //更新文案
  132. //最新版本
  133. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  134. //版本号
  135. if (wgtinfo.version == res.data.version) {
  136. this.show_s = true
  137. uni.showToast({
  138. icon: 'none',
  139. title: this.$t('setUp.tips1'),
  140. position: "bottom"
  141. })
  142. } else if (wgtinfo.version != res.data.forceVersion) {
  143. res.data.msg = res.data.msg.replace(/\\n/g, "\n")
  144. uni.showModal({
  145. title: this.$t('setUp.tips2'),
  146. content: res.data.msg,
  147. showCancel: false,
  148. confirmText: this.$t('setUp.tips4'),
  149. success: function(res) {
  150. if (res.confirm) {
  151. let appleId = 1518555723
  152. plus.runtime.launchApplication({
  153. action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`
  154. }, function(e) {
  155. });
  156. } else if (res.cancel) {
  157. }
  158. }
  159. })
  160. } else if (wgtinfo.version == res.data.forceVersion) {
  161. res.data.msg = res.data.msg.replace(/\\n/g, "\n")
  162. uni.showModal({
  163. title: this.$t('setUp.tips2'),
  164. content: res.data.msg,
  165. showCancel: true,
  166. confirmText: this.$t('setUp.tips4'),
  167. success: function(res) {
  168. if (res.confirm) {
  169. let appleId = 1518555723
  170. plus.runtime.launchApplication({
  171. action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`
  172. }, function(e) {
  173. });
  174. } else if (res.cancel) {
  175. }
  176. }
  177. })
  178. }
  179. })
  180. }).catch(err => {
  181. })
  182. .finally(() => {
  183. // Loading.close()
  184. })
  185. },
  186. onLaunch_s() {
  187. //升级调用的接口
  188. if (this.show_s == true) {
  189. this.show_s = false
  190. }
  191. request({
  192. url: '/baseReq/apkUpgrade',
  193. method: 'get',
  194. params: {
  195. osType: 0
  196. }
  197. }).then(res => {
  198. //最低版本
  199. //更新文案
  200. //下载最新版地址
  201. //最新版本
  202. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  203. //版本号
  204. if (wgtinfo.version == res.data.version) {
  205. this.show_s = false
  206. uni.showToast({
  207. icon: 'none',
  208. title: this.$t('setUp.tips1'),
  209. position: "bottom"
  210. })
  211. this.closeModal();
  212. } else if (wgtinfo.version != res.data.forceVersion) {
  213. this.Copywriting = res.data.msg
  214. this.show_s = true
  215. this.url = res.data.url
  216. this.is_force = true
  217. } else if (wgtinfo.version == res.data.forceVersion) {
  218. this.Copywriting = res.data.msg
  219. this.is_force = false
  220. this.show_s = true
  221. this.url = res.data.url
  222. }
  223. })
  224. }).catch(err => {
  225. })
  226. .finally(() => {
  227. // Loading.close()
  228. })
  229. },
  230. getMyinfo() {
  231. request({
  232. url: "/myapp/selectStore",
  233. method: "post",
  234. data: {
  235. storeId: this.$store.state.storeInfo.storeId,
  236. },
  237. })
  238. .then((res) => {
  239. this.userInfo = res.data.data;
  240. })
  241. .catch((err) => {
  242. })
  243. .finally(() => {
  244. this.loading = false;
  245. uni.hideLoading();
  246. });
  247. },
  248. tishi() {
  249. this.$u.toast(this.$t('setUp.tips3'));
  250. }
  251. },
  252. };
  253. </script>
  254. <style>
  255. </style>