shangjiaView.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642
  1. <template>
  2. <view style="background-color: whitesmoke;" @touchstart="rightF" @touchend="leftF">
  3. <customNav :shownav="true" :title="posName" titledetl=""></customNav>
  4. <view style="width: 100%;height: 80rpx;background-color: #00A6FF;"></view>
  5. <view class="nodetail">
  6. <view class="contentInRowS" style="width: 100%;">
  7. <netImage style="margin-left: 12rpx;margin-top: -20rpx;" width="160" height="160" bradius="80"
  8. :mysrc="mendianMs.logo" mymode="scaleToFill"></netImage>
  9. <view class="contentColumn" style="width: 500rpx;margin-right: 20rpx;">
  10. <text class="dianpuming">{{mendianMs.posName}}</text>
  11. <text class="peisongsuoming">{{$t('index.manX')}} {{$formPr(mendianMs.posPrice)}}
  12. {{$t('locale.huobidw')}}</text>
  13. <view class="contentInRowS">
  14. <view class="contentColumnC" style="width: 24%; visibility: hidden;">
  15. <image class="actimge" :src="shouchangIcon" mode="aspectFit" @click="shouchang"></image>
  16. <text class="textfontS3">{{$t('index.shouchang')}}</text>
  17. </view>
  18. <view class="contentColumnC" style="width: 24%;">
  19. <image class="actimge" src="/static/images/daipinglun@3x.png" mode="aspectFit"
  20. @click="pinglunList"></image>
  21. <text class="textfontS3">{{$t('index.pinglun')}}</text>
  22. </view>
  23. <view class="contentColumnC" style="width: 24%;">
  24. <image class="actimge" src="/static/images/gengduozx.png" mode="aspectFit"
  25. @click="gengduozx"></image>
  26. <text class="textfontS3">{{$t('index.mendian')}}</text>
  27. </view>
  28. <view class="contentColumnC" style="width: 24%;">
  29. <image class="actimge" src="/static/images/lianxikf.png" mode="aspectFit"
  30. @click="callPhone"></image>
  31. <text class="textfontS3">{{$t('mend.kefudianhua')}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view v-if="mendianMs.state==1" class="contentInRowR">
  37. <text
  38. style="margin-top: 10rpx;color: darkgreen;font-size: 28rpx;padding-right: 40rpx;">{{$t('mend.statedy')}}</text>
  39. </view>
  40. <view style="height: 20rpx;"></view>
  41. </view>
  42. <view v-if="cuxiaoImge.length==0">
  43. <netImage style="margin-top:20rpx;margin-left: 25rpx;" width="700" height="400" bradius="6"
  44. :mysrc="mendianMs.image" mymode="scaleToFill"></netImage>
  45. </view>
  46. <view v-if="cuxiaoImge.length>0"><!-- 促销活动 -->
  47. <swiperImgs style="margin-top: 20rpx;" width="750" height="400" :imageList="cuxiaoImge"></swiperImgs>
  48. </view>
  49. <view style="margin-top: 40rpx;">
  50. <view :class="[(isFixedTop[0]) ?cssName:'']" id="box" class="box">
  51. <view class="contentInRowL"
  52. style="width: 90%;margin-left: 5%;margin-bottom: 20rpx;align-items: center;">
  53. <view>
  54. <text class="fenleiTitle" @click="popfenlei">{{$t('index.goodsfenlei')}}</text>
  55. </view>
  56. <image class="actimgezy" style="margin-left: 10rpx;" src="/static/images/zuoyouhd.png"
  57. mode="aspectFit"></image>
  58. <view class="">
  59. <swiper style="height: 60rpx;width: 450rpx;align-items: center;" display-multiple-items="2"
  60. :indicator-dots="false" :autoplay="false" :current="current" :duration="500"
  61. @animationfinish="fenleiSel">
  62. <swiper-item v-for="(item,index) in shangpinfenlei">
  63. <view class="swiper-item text1row">{{item.name}}</view>
  64. </swiper-item>
  65. </swiper>
  66. </view>
  67. </view>
  68. </view>
  69. <view v-if="shangpinfenlei.length>0" class="page-view contentColumnC">
  70. <view class="contentInRowC">
  71. <text class="textdop2"></text>
  72. <text class="textdop1"></text>
  73. <text class="text2row"
  74. style="margin-left: 10rpx;font-size: 30rpx;font-weight: bold;max-width: 600rpx;">{{shangpinfenlei[current].name}}</text>
  75. <text class="textdop1"></text>
  76. <text class="textdop2"></text>
  77. </view>
  78. </view>
  79. <view class="page-view contentColumn">
  80. <view class="item_list">
  81. <view class="item_content" v-for="(item1, index1) in shangpinlist" :key="index1">
  82. <view v-if="item1.stackingUp==0" class="thumb-boxR contentColumnC">
  83. <netImage class="goodimage" width="334" height="334" :mysrc="item1.image"
  84. mymode="scaleToFill" v-on:Emyimageclick="shangpinsl(item1.id)"></netImage>
  85. <view class="msText">
  86. <text class="dianpuming" @click="shangpinsl(item1.id)">{{item1.name}}</text>
  87. <view class="buyBT">
  88. <text class="peisongsuoming detailtextV">{{item1.introduce}}</text>
  89. </view>
  90. <view v-if="shangpingoumaiS[current][index1]" class="buyBTSB">
  91. <text class="peisongsuoming">{{$formPr(item1.price)}}{{$t('locale.huobidw')}}</text>
  92. <view v-if="item1.stackingUp==0" class="rconten">
  93. <image v-if="shangpingoumaiS[current][index1].shuliang>0" class="imageRJ"
  94. src="/static/images/jian@3x.png" mode="aspectFit"
  95. @click="jiangouwuche(index1)"></image>
  96. <text v-if="shangpingoumaiS[current][index1].shuliang>0"
  97. class="textR">{{shangpingoumaiS[current][index1].shuliang}}</text>
  98. <image class="imageR" src="/static/images/plus-circle-fill@3x.png"
  99. mode="aspectFit" @click="editSKU(index1)"></image>
  100. </view>
  101. <view v-if="item1.stackingUp==1" class="rconten">
  102. <text class="textR">{{$t('mend.yixiajia')}}</text>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. <view style="height: 260rpx;"></view>
  110. </view>
  111. </view>
  112. <!-- <view v-if="dailinghb.length>0" class="hongbaoFV">
  113. <view class="hongbaoImage" @click="openhbkq">
  114. <image src="/static/images/hongbkq.png" style="width: 100%;height: 100%;" mode="aspectFit"></image>
  115. </view>
  116. </view> -->
  117. <view class="bottomfloatV">
  118. <view class="buyBT">
  119. <image class="gouwuche" :src="gouwcheimg" mode="aspectFit" @click="gotoGouwuche"></image>
  120. <text class="peisongsuoming">{{notext}}</text>
  121. <text class="qjs" :style="{backgroundColor:gwbcolor,color:gwbTcolor}"
  122. @click="gotojiesuan">{{$t('comp.qujiesuan')}}</text>
  123. </view>
  124. </view>
  125. <popViewGG :show="showpop" :showbotom="false" :maskClosable="true" :isCancel="true"
  126. @chooseCancel="chooseCancel">
  127. <foodxuangou style="width:100%;max-height: 70vh" :food="spindexSP" v-on:Ejiagouwuche="jiagouwuche">
  128. </foodxuangou>
  129. </popViewGG>
  130. <uni-popup style="z-index: 999;" ref="popfl" type="center" :isMaskClick="true" :safeArea="true">
  131. <view class="contentColumnC" style="width:660upx;background-color:white;border-radius: 8rpx;">
  132. <text class="fenleiTitle"
  133. style="margin-top: 16rpx;margin-bottom: 16rpx;">{{$t('index.goodsfenlei')}}</text>
  134. <scroll-view scroll-y="true" style="max-height: 400rpx;">
  135. <view>
  136. <view class="" v-for="(item,index) in shangpinfenlei">
  137. <view class="fenleiitem" @click="ppfenleisel(index)">{{item.name}}</view>
  138. </view>
  139. </view>
  140. </scroll-view>
  141. <view style="height: 20rpx;"></view>
  142. </view>
  143. </uni-popup>
  144. <popViewGG :show="hongbkqs" :acttips="$t('order.queding')" :maskClosable="true" :isCancel="false"
  145. @chooseCancel="chooseCancel">
  146. <view class="contentColumnC" style="width: 100%;background-color: whitesmoke;">
  147. <view class="contentColumnC" style="height: 80rpx;width: 100%;background-color: lightgray;">
  148. <view class="contentInRowS" style="height: 80rpx;width: 90%;">
  149. <text style="font-size: 30rpx;color: crimson;"></text>
  150. <text style="font-size: 28rpx;">{{$t('index.hongbaokq')}}</text>
  151. <text style="font-size: 30rpx;color: #00A6FF;"
  152. @click="querenyhhd">{{$t('order.queding')}}</text>
  153. </view>
  154. </view>
  155. <view v-if="dailinghb.length>0" style="width: 90%;">
  156. <view class="contentColumn" style="margin-top: 16rpx;" v-for="(item, index) in dailinghb"
  157. :key="index">
  158. <view class="contentInRowS">
  159. <view class="contentColumn withpophbkq"
  160. :style="item.type==0?'color: #00A6FF;':'color:green;'">
  161. <text style="font-size: 28rpx;">{{item.name}}</text>
  162. <text style="font-size: 28rpx;">{{getNote(item,1)}}</text>
  163. </view>
  164. <view class="contentInRowC"
  165. style="width: 150rpx;height:50rpx;background-color:chocolate;border-radius: 6rpx;"
  166. @click="lingququan(item.id)">
  167. <text style="font-size: 26rpx;color: white;">{{$t("hongbaokq.lingqu")}}</text>
  168. </view>
  169. </view>
  170. </view>
  171. </view>
  172. <view style="height: 80rpx;"></view>
  173. </view>
  174. </popViewGG>
  175. <!-- 下载app弹窗 -->
  176. <uni-popup ref="downloadPopup" type="center" :mask-click="true">
  177. <view class="download-popup-content">
  178. <!-- 标题栏 -->
  179. <view class="download-popup-header">
  180. <text class="download-popup-title">{{$t('api.message')}}</text>
  181. <view class="download-popup-close" @click="closeDownloadPopup">
  182. <text class="close-icon">×</text>
  183. </view>
  184. </view>
  185. <!-- 内容 -->
  186. <view class="download-popup-body">
  187. <text class="download-popup-text">{{$t('jiesuan.xiazapp')}}</text>
  188. </view>
  189. <!-- 按钮 -->
  190. <view class="download-popup-buttons">
  191. <view class="download-popup-btn download-popup-btn-ios" @click="downloadIOS">
  192. <text class="download-popup-btn-text">{{$t('jiesuan.xzios')}}</text>
  193. </view>
  194. <view class="download-popup-btn download-popup-btn-android" @click="downloadAndroid">
  195. <text class="download-popup-btn-text">{{$t('jiesuan.xiazandriod')}}</text>
  196. </view>
  197. </view>
  198. </view>
  199. </uni-popup>
  200. </view>
  201. </template>
  202. <script>
  203. import api from "@/pages/api/api.js";
  204. export default {
  205. data() {
  206. return {
  207. isFixedTop: [],
  208. Topdistance: [],
  209. cssName: '',
  210. //------------------------------
  211. cuxiaoImge: [],
  212. id: 1,
  213. userid: 0,
  214. mendianMs: [],
  215. posName: '',
  216. isfirstShow: 0,
  217. isShouchang: 0,
  218. shouchangIcon: '/static/images/faver@3x.png',
  219. option: {},
  220. login: false,
  221. showpop: false,
  222. gouwuche: '',
  223. scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
  224. shangpinfenlei: [],
  225. shangpinlist: [],
  226. shangpingoumaiS: [],
  227. current: 0, // 当前分类值
  228. spindex: 0, //当前分类商品操作INDEX
  229. spindexSP: '', //当前分类商品操作INDEX对应商品
  230. itemId: 0, // 栏目右边scroll-view用于滚动的id
  231. gouwcheimg: '/static/images/gouwuh@3x.png',
  232. notext: this.$t('comp.weixgsp'),
  233. goumaijine: 0,
  234. gwbcolor: 'darkgray',
  235. gwbTcolor: 'black',
  236. startX: 0,
  237. startY: 0,
  238. lang: '0',
  239. dailinghb: [],
  240. hongbkqs: false,
  241. downloadUrls: {},
  242. isShangjia: 0,
  243. id: 0,
  244. }
  245. },
  246. onShow() {
  247. if (0 == this.isfirstShow) {
  248. this.getmendianDetail(this.id);
  249. this.isfirstShow = 1;
  250. } else {
  251. this.refleashdata();
  252. }
  253. // this.getHbkaq();
  254. var that = this;
  255. try { //读取
  256. that.token = uni.getStorageSync("token");
  257. //console.log('2222',that.token)
  258. if (that.token == '' || that.token == undefined || that.token == null) {
  259. that.login = false;
  260. return;
  261. } else {
  262. that.login = true;
  263. return;
  264. }
  265. } catch (e) { //错误
  266. return;
  267. }
  268. },
  269. onLoad(option) {
  270. console.log(option)
  271. if (!('id' in option) || !('isShangjia' in option) || !('language' in option)) {
  272. this.$nextTick(() => {
  273. uni.showToast({
  274. title: this.$t('mend.wuxiaofw'),
  275. icon: 'error',
  276. duration: 2000
  277. });
  278. });
  279. return
  280. }
  281. this.isShangjia = option.isShangjia
  282. this.id = option.id
  283. var code = option.language
  284. console.log(code)
  285. uni.setStorageSync('language', code);
  286. uni.setLocale(code);
  287. this.$i18n.locale = code;
  288. var language = uni.getStorageSync('language');
  289. if (language == 'yuenan') {
  290. this.lang = '0';
  291. }
  292. if (language == 'zh-Hans') {
  293. this.lang = '2';
  294. }
  295. if (language == 'zh-Hant') {
  296. this.lang = '3';
  297. }
  298. this.id = option.id;
  299. this.refleashdata();
  300. uni.pageScrollTo({
  301. scrollTop: 0,
  302. duration: 0
  303. })
  304. var info = uni.getSystemInfoSync();
  305. var isAndroid = info.platform.toLowerCase() === 'android';
  306. if (isAndroid) {
  307. this.cssName = 'fixedTop';
  308. } else {
  309. this.cssName = 'fixedTopios';
  310. }
  311. },
  312. mounted() {
  313. this.GetTop()
  314. },
  315. onPageScroll(e) {
  316. const that = this
  317. // console.log(e.scrollTop,JSON.stringify(this.Topdistance),JSON.stringify(this.isFixedTop))
  318. for (let i = 0; i < this.Topdistance.length; i++) {
  319. if (e.scrollTop > this.Topdistance[i] - 70) {
  320. // console.log('***************')
  321. this.isFixedTop[i] = true
  322. this.$set(this.isFixedTop, i, true)
  323. this.isFixedTop[i] = true
  324. } else {
  325. // console.log('++++++++++')
  326. this.isFixedTop[i] = false
  327. this.$set(this.isFixedTop, i, false)
  328. this.isFixedTop[i] = false
  329. }
  330. }
  331. },
  332. methods: {
  333. // 检测是否为安卓设备
  334. isAndroidDevice() {
  335. // 在H5环境中检测
  336. // #ifdef H5
  337. const ua = navigator.userAgent.toLowerCase();
  338. return ua.indexOf('android') > -1;
  339. // #endif
  340. // 在App环境中检测
  341. // #ifdef APP-PLUS
  342. return plus.os.name === 'Android';
  343. // #endif
  344. // 其他环境默认返回false
  345. return false;
  346. },
  347. // 检测是否为iOS设备
  348. isIOSDevice() {
  349. // #ifdef H5
  350. const ua = navigator.userAgent.toLowerCase();
  351. return /iphone|ipad|ipod/.test(ua);
  352. // #endif
  353. // #ifdef APP-PLUS
  354. return plus.os.name === 'iOS';
  355. // #endif
  356. return false;
  357. },
  358. // 显示下载app提示
  359. showDownloadAppModal() {
  360. api('getAppDownload', {}, r => {
  361. console.log(r)
  362. this.downloadUrls = r.data.data;
  363. this.$refs.downloadPopup.open();
  364. });
  365. },
  366. // 关闭下载app弹窗
  367. closeDownloadPopup() {
  368. this.$refs.downloadPopup.close();
  369. },
  370. // 下载iOS版本
  371. downloadIOS() {
  372. // 先尝试打开已安装的应用
  373. this.tryOpenInstalledApp();
  374. this.closeDownloadPopup();
  375. },
  376. // 下载Android版本
  377. downloadAndroid() {
  378. // 先尝试打开已安装的应用
  379. this.tryOpenInstalledApp();
  380. this.closeDownloadPopup();
  381. },
  382. // 尝试打开已安装的应用
  383. tryOpenInstalledApp() {
  384. const that = this;
  385. const appSchema = 'cityexpressuser://pages/shanpinxungou/shangjia/shangjiaView?id=' + this.id +
  386. '&isShangjia=' + this.isShangjia;
  387. // 在App环境中使用plus.runtime.openURL
  388. // #ifdef APP-PLUS
  389. plus.runtime.openURL(appSchema, function() {
  390. console.log(that.$t('download.app_opened_success'));
  391. }, function(e) {
  392. console.log(that.$t('download.app_not_installed'));
  393. // 应用未安装,继续下载流程
  394. that.startDownloadProcess();
  395. });
  396. // #endif
  397. // 在H5环境中尝试打开应用
  398. // #ifdef H5
  399. this.tryOpenAppInH5(appSchema);
  400. // #endif
  401. },
  402. // 在H5环境中尝试打开应用
  403. tryOpenAppInH5(appSchema) {
  404. const that = this;
  405. // 检测是否为iOS设备
  406. const isIOS = this.isIOSDevice();
  407. if (isIOS) {
  408. // iOS设备使用特殊处理
  409. this.tryOpenIOSApp(appSchema);
  410. } else {
  411. // 安卓设备使用iframe方式
  412. this.tryOpenAndroidApp(appSchema);
  413. }
  414. },
  415. // 尝试打开iOS应用
  416. tryOpenIOSApp(appSchema) {
  417. const that = this;
  418. // 记录开始时间
  419. const startTime = Date.now();
  420. let hasApp = false;
  421. // 监听页面可见性变化
  422. const handleVisibilityChange = () => {
  423. if (document.hidden) {
  424. hasApp = true;
  425. clearTimeout(timeout);
  426. document.removeEventListener('visibilitychange', handleVisibilityChange);
  427. document.removeEventListener('pagehide', handlePageHide);
  428. document.removeEventListener('blur', handleBlur);
  429. }
  430. };
  431. // 监听页面隐藏事件
  432. const handlePageHide = () => {
  433. hasApp = true;
  434. clearTimeout(timeout);
  435. document.removeEventListener('visibilitychange', handleVisibilityChange);
  436. document.removeEventListener('pagehide', handlePageHide);
  437. document.removeEventListener('blur', handleBlur);
  438. };
  439. // 监听窗口失焦事件
  440. const handleBlur = () => {
  441. hasApp = true;
  442. clearTimeout(timeout);
  443. document.removeEventListener('visibilitychange', handleVisibilityChange);
  444. document.removeEventListener('pagehide', handlePageHide);
  445. document.removeEventListener('blur', handleBlur);
  446. };
  447. // 设置超时检测
  448. const timeout = setTimeout(() => {
  449. if (!hasApp) {
  450. // 应用未安装,继续下载流程
  451. that.startDownloadProcess();
  452. }
  453. document.removeEventListener('visibilitychange', handleVisibilityChange);
  454. document.removeEventListener('pagehide', handlePageHide);
  455. document.removeEventListener('blur', handleBlur);
  456. }, 1500); // 缩短超时时间
  457. // 添加事件监听器
  458. document.addEventListener('visibilitychange', handleVisibilityChange);
  459. document.addEventListener('pagehide', handlePageHide);
  460. window.addEventListener('blur', handleBlur);
  461. // 尝试打开应用
  462. try {
  463. // 方法1: 直接使用window.location
  464. window.location.href = appSchema;
  465. } catch (e) {
  466. // 方法2: 使用iframe
  467. const iframe = document.createElement('iframe');
  468. iframe.style.display = 'none';
  469. iframe.style.width = '1px';
  470. iframe.style.height = '1px';
  471. iframe.src = appSchema;
  472. document.body.appendChild(iframe);
  473. // 清理iframe
  474. setTimeout(() => {
  475. if (document.body.contains(iframe)) {
  476. document.body.removeChild(iframe);
  477. }
  478. }, 1000);
  479. }
  480. },
  481. // 尝试打开安卓应用
  482. tryOpenAndroidApp(appSchema) {
  483. const that = this;
  484. let hasApp = false;
  485. // 监听页面可见性变化
  486. const handleVisibilityChange = () => {
  487. if (document.hidden) {
  488. hasApp = true;
  489. clearTimeout(timeout);
  490. document.removeEventListener('visibilitychange', handleVisibilityChange);
  491. document.removeEventListener('pagehide', handlePageHide);
  492. document.removeEventListener('blur', handleBlur);
  493. }
  494. };
  495. // 监听页面隐藏事件
  496. const handlePageHide = () => {
  497. hasApp = true;
  498. clearTimeout(timeout);
  499. document.removeEventListener('visibilitychange', handleVisibilityChange);
  500. document.removeEventListener('pagehide', handlePageHide);
  501. document.removeEventListener('blur', handleBlur);
  502. };
  503. // 监听窗口失焦事件
  504. const handleBlur = () => {
  505. hasApp = true;
  506. clearTimeout(timeout);
  507. document.removeEventListener('visibilitychange', handleVisibilityChange);
  508. document.removeEventListener('pagehide', handlePageHide);
  509. document.removeEventListener('blur', handleBlur);
  510. };
  511. // 设置超时检测
  512. const timeout = setTimeout(() => {
  513. if (!hasApp) {
  514. // 应用未安装,继续下载流程
  515. that.startDownloadProcess();
  516. }
  517. document.removeEventListener('visibilitychange', handleVisibilityChange);
  518. document.removeEventListener('pagehide', handlePageHide);
  519. document.removeEventListener('blur', handleBlur);
  520. }, 1500); // 缩短超时时间
  521. // 添加事件监听器
  522. document.addEventListener('visibilitychange', handleVisibilityChange);
  523. document.addEventListener('pagehide', handlePageHide);
  524. window.addEventListener('blur', handleBlur);
  525. // 尝试打开应用
  526. try {
  527. // 方法1: 直接使用window.location
  528. window.location.href = appSchema;
  529. } catch (e) {
  530. // 方法2: 使用iframe
  531. const iframe = document.createElement('iframe');
  532. iframe.style.display = 'none';
  533. iframe.style.width = '1px';
  534. iframe.style.height = '1px';
  535. iframe.src = appSchema;
  536. document.body.appendChild(iframe);
  537. // 清理iframe
  538. setTimeout(() => {
  539. if (document.body.contains(iframe)) {
  540. document.body.removeChild(iframe);
  541. }
  542. }, 1000);
  543. }
  544. },
  545. // 开始下载流程
  546. startDownloadProcess() {
  547. const that = this;
  548. // 显示下载提示
  549. uni.showLoading({
  550. title: this.$t('download.downloading'),
  551. mask: true
  552. });
  553. // 获取下载链接
  554. api('getAppDownload', {}, r => {
  555. console.log(r);
  556. // 检测是否为安卓设备
  557. const isAndroid = this.isAndroidDevice();
  558. if (isAndroid) {
  559. // 安卓设备下载APK
  560. that.downloadAndroidAPK(r.data.data.androidUrl);
  561. } else {
  562. // iOS设备打开App Store
  563. that.openAppStore(r.data.data.iosUrl);
  564. }
  565. });
  566. },
  567. // 下载安卓APK
  568. downloadAndroidAPK(androidUrl) {
  569. const that = this;
  570. // 在App环境中使用plus.downloader
  571. // #ifdef APP-PLUS
  572. const appDownloadTask = plus.downloader.createDownload(androidUrl, {
  573. filename: '_downloads/CTE.apk'
  574. }, function(download, status) {
  575. uni.hideLoading();
  576. if (status === 200) {
  577. // 下载成功,尝试安装
  578. that.installAndroidApp(download.filename);
  579. } else {
  580. uni.showToast({
  581. title: that.$t('download.download_failed'),
  582. icon: 'none',
  583. duration: 2000
  584. });
  585. }
  586. });
  587. // 监听下载进度
  588. appDownloadTask.addEventListener('statechanged', function(download, status) {
  589. if (status === 200) {
  590. const progress = Math.round((download.downloadedSize / download.totalSize) * 100);
  591. uni.showLoading({
  592. title: that.$t('download.downloading_progress', {
  593. progress: progress
  594. }),
  595. mask: true
  596. });
  597. }
  598. });
  599. appDownloadTask.start();
  600. // #endif
  601. // 在H5环境中使用uni.downloadFile
  602. // #ifdef H5
  603. const h5DownloadTask = uni.downloadFile({
  604. url: androidUrl,
  605. success: function(res) {
  606. uni.hideLoading();
  607. if (res.statusCode === 200) {
  608. // 下载成功,尝试安装
  609. that.installAndroidApp(res.tempFilePath);
  610. } else {
  611. uni.showToast({
  612. title: that.$t('download.download_failed'),
  613. icon: 'none',
  614. duration: 2000
  615. });
  616. }
  617. },
  618. fail: function(err) {
  619. uni.hideLoading();
  620. console.log('下载失败:', err);
  621. // 下载失败时,提供手动下载选项
  622. uni.showModal({
  623. title: that.$t('download.download_failed'),
  624. content: that.$t('download.download_failed_manual'),
  625. showCancel: true,
  626. cancelText: that.$t('comp.quxiao'),
  627. confirmText: that.$t('comp.queren'),
  628. success: function(res) {
  629. if (res.confirm) {
  630. // 使用浏览器打开下载链接
  631. window.open(androidUrl, '_blank');
  632. }
  633. }
  634. });
  635. }
  636. });
  637. // 监听下载进度
  638. h5DownloadTask.onProgressUpdate(function(res) {
  639. const progress = Math.round(res.progress);
  640. uni.showLoading({
  641. title: that.$t('download.downloading_progress', {
  642. progress: progress
  643. }),
  644. mask: true
  645. });
  646. });
  647. // #endif
  648. },
  649. // 打开App Store
  650. openAppStore(iosUrl) {
  651. const that = this;
  652. // 在App环境中使用plus.runtime.openURL
  653. // #ifdef APP-PLUS
  654. plus.runtime.openURL(
  655. 'itms-apps://itunes.apple.com/cn/app/cte/id6468907188',
  656. (res) => {
  657. console.log(that.$t('download.app_store_success'))
  658. },
  659. (err) => {
  660. console.log(that.$t('download.app_store_failed'))
  661. // 如果 itms-apps:// 失败,回退到浏览器打开
  662. plus.runtime.openURL('https://apps.apple.com/cn/app/cte/id6468907188')
  663. }
  664. );
  665. // #endif
  666. // 在H5环境中,针对iOS设备优化
  667. // #ifdef H5
  668. // 先尝试直接打开App Store链接
  669. const appStoreUrl = 'https://apps.apple.com/cn/app/cte/id6468907188';
  670. // 尝试多种方式打开App Store
  671. that.tryOpenAppStore(appStoreUrl);
  672. // #endif
  673. },
  674. // 安装安卓应用
  675. installAndroidApp(filePath) {
  676. const that = this;
  677. // 在App环境中,直接尝试安装APK
  678. // #ifdef APP-PLUS
  679. uni.showModal({
  680. title: that.$t('download.download_complete'),
  681. content: that.$t('download.install_confirm'),
  682. showCancel: true,
  683. cancelText: that.$t('comp.quxiao'),
  684. confirmText: that.$t('comp.queren'),
  685. success: function(res) {
  686. if (res.confirm) {
  687. // 使用plus.runtime.install安装APK
  688. plus.runtime.install(filePath, {
  689. force: false
  690. }, function() {
  691. uni.showToast({
  692. title: that.$t('download.install_success'),
  693. icon: 'success',
  694. duration: 2000
  695. });
  696. }, function(e) {
  697. console.log('安装失败:', e);
  698. uni.showModal({
  699. title: that.$t('download.install_failed'),
  700. content: that.$t('download.install_failed_manual'),
  701. showCancel: true,
  702. cancelText: that.$t('comp.quxiao'),
  703. confirmText: that.$t('comp.queren'),
  704. success: function(res) {
  705. if (res.confirm) {
  706. // 打开文件管理器
  707. plus.runtime.openFile(filePath);
  708. }
  709. }
  710. });
  711. });
  712. }
  713. }
  714. });
  715. // #endif
  716. // 在H5环境中,提示用户手动安装
  717. // #ifdef H5
  718. uni.showModal({
  719. title: that.$t('download.download_complete'),
  720. content: that.$t('download.manual_install_hint'),
  721. showCancel: false,
  722. confirmText: that.$t('comp.queren'),
  723. success: function(res) {
  724. if (res.confirm) {
  725. // 尝试打开下载链接,让用户手动下载
  726. window.open(filePath, '_blank');
  727. }
  728. }
  729. });
  730. // #endif
  731. },
  732. // 尝试打开App Store的多种方式
  733. tryOpenAppStore(appStoreUrl) {
  734. // 方法1: 直接使用window.open
  735. const newWindow = window.open(appStoreUrl, '_blank');
  736. // 如果新窗口被阻止,尝试其他方法
  737. if (!newWindow || newWindow.closed || typeof newWindow.closed == 'undefined') {
  738. // 方法2: 尝试使用itms-apps协议
  739. this.tryItmsProtocol();
  740. }
  741. },
  742. // 尝试使用itms-apps协议
  743. tryItmsProtocol() {
  744. const itmsUrl = 'itms-apps://itunes.apple.com/cn/app/cte/id6468907188';
  745. // 创建一个隐藏的iframe来尝试打开itms-apps协议
  746. const iframe = document.createElement('iframe');
  747. iframe.style.display = 'none';
  748. iframe.style.width = '1px';
  749. iframe.style.height = '1px';
  750. iframe.src = itmsUrl;
  751. document.body.appendChild(iframe);
  752. // 设置超时,如果App Store没有打开,则回退到浏览器
  753. setTimeout(() => {
  754. if (document.body.contains(iframe)) {
  755. document.body.removeChild(iframe);
  756. }
  757. // 最后回退到浏览器打开
  758. window.location.href = 'https://apps.apple.com/cn/app/cte/id6468907188';
  759. }, 1500);
  760. },
  761. //选择和领取红包卡券
  762. getHbkaq() {
  763. console.log('1212------------------')
  764. api('userUnclaimedList', {
  765. pageNum: '1',
  766. pageSize: '30',
  767. mdId: this.id
  768. }, res => {
  769. console.log('-----------', res)
  770. if (res.data.code == 200) {
  771. this.dailinghb = res.data.rows;
  772. }
  773. }, failc => {
  774. console.log('getadvertis----', failc)
  775. })
  776. },
  777. openhbkq() {
  778. this.hongbkqs = true;
  779. },
  780. querenyhhd() {
  781. this.hongbkqs = false;
  782. },
  783. getNote(obj, index) {
  784. var str = '';
  785. if (index == 1) {
  786. if (obj.yhfangs == 1 && obj.yhnum > 1) { //优惠方式:1 运费,2 订单 ,3 商品
  787. str = this.$t('hongbaokq.yunfeiyh');
  788. }
  789. if (obj.yhfangs == 1 && obj.yhnum < 1 && obj.yhnum > 0) { //优惠方式:1 运费,2 订单 ,3 商品
  790. str = this.$t('hongbaokq.yunfeizk');
  791. }
  792. if (obj.yhfangs == 1 && obj.yhnum == 0) { //优惠方式:1 运费,2 订单 ,3 商品
  793. str = this.$t('hongbaokq.yunfeiquanm');
  794. }
  795. if (obj.yhfangs == 2 && obj.yhnum > 1) {
  796. str = this.$t('hongbaokq.dingdanyh');
  797. }
  798. if (obj.yhfangs == 2 && obj.yhnum < 1) {
  799. str = this.$t('hongbaokq.dingdanzk');
  800. }
  801. if (obj.yhfangs == 3 && obj.yhnum > 1) {
  802. str = this.$t('hongbaokq.shangpinyh');
  803. }
  804. if (obj.yhfangs == 3 && obj.yhnum < 1) {
  805. str = this.$t('hongbaokq.shangpinzk');
  806. }
  807. if (obj.yhnum != 0) {
  808. str = str + ' ' + obj.yhnum;
  809. }
  810. }
  811. return str;
  812. },
  813. lingququan(id) {
  814. api('userQuanyireceive', {
  815. quanyiId: id,
  816. num: 1
  817. }, r => {
  818. console.log('-----------', r)
  819. if (r.data.code == 200) {
  820. this.getHbkaq();
  821. uni.showToast({
  822. title: this.$t('hongbaokq.lingqucg'),
  823. icon: 'none',
  824. duration: 2500
  825. })
  826. } else {
  827. uni.showToast({
  828. title: this.$t('hongbaokq.lingqushib'),
  829. icon: 'none',
  830. duration: 2500
  831. })
  832. }
  833. }, failc => {
  834. uni.showToast({
  835. title: this.$t('hongbaokq.lingqushib'),
  836. icon: 'none',
  837. duration: 2500
  838. })
  839. //console.log('getadvertis----',failc)
  840. })
  841. },
  842. //----------------------------------------------------
  843. GetTop() {
  844. var _this = this
  845. uni.getSystemInfo({
  846. success: (resu) => {
  847. //console.log('resu',JSON.stringify(resu))
  848. const query = uni.createSelectorQuery().in(this)
  849. query.selectAll('.box').boundingClientRect()
  850. query.selectViewport().scrollOffset()
  851. query.exec(function(res) {
  852. //console.log('res',JSON.stringify(res))
  853. _this.arr(res[0])
  854. })
  855. },
  856. fail: (res) => {}
  857. })
  858. },
  859. arr(res) {
  860. for (let i = 0; i < res.length; i++) {
  861. this.Topdistance[i] = res[i].top
  862. this.isFixedTop[i] = false
  863. }
  864. //console.log('----',JSON.stringify(this.Topdistance))
  865. },
  866. //------------------------------------------------------------------------------
  867. rightF(e) {
  868. //console.log('rightF',e)
  869. this.startX = e.changedTouches[0].pageX;
  870. this.startY = e.changedTouches[0].pageY;
  871. },
  872. leftF(e) {
  873. //console.log('leftF',e)
  874. var s, n;
  875. s = e.changedTouches[0].pageX;
  876. n = e.changedTouches[0].pageY;
  877. var dx, dy;
  878. dx = this.startX - s;
  879. dy = Math.abs(this.startY - n);
  880. if (Math.abs(dx) > 100 && Math.abs(dx) > dy) {
  881. if (dx > 0) {
  882. if (this.current < this.shangpinfenlei.length - 1) {
  883. this.current = this.current + 1;
  884. }
  885. } else {
  886. if (this.current > 0) {
  887. this.current = this.current - 1;
  888. }
  889. }
  890. }
  891. },
  892. fanhui() {
  893. uni.navigateBack();
  894. },
  895. shareToggle() {
  896. this.$refs.share.open()
  897. },
  898. chooseCancel() {
  899. this.showpop = false;
  900. this.hongbkqs = false;
  901. },
  902. fenxiang(item, index) {
  903. this.option = {
  904. //绘制海报内容
  905. //codeUrl: 'https://pic1.zhimg.com/80/v2-2714df42147132464a71af391ed04be4_720w.jpg', //小程序太阳码
  906. codeUrl: '/static/defimages/erweim.png', //小程序太阳码
  907. coverUrl: '/static/defimages/ddd.png', //题库图片
  908. headUrl: '/static/logo.png', //头像
  909. //bgUrl: 'https://pic3.zhimg.com/v2-8fbde0f9ac6a19a23aa839e73394618a_b.jpg', //图片背景填充,和 fillStyle 只能传一个,bgUrl 优先级高于 fillStyle
  910. fillStyle: '#00A6FF', //纯色背景填充颜色
  911. nickName: '跑腿王', //授权登录的用户名
  912. miniName: '不出门吃遍全世界', //小程序名称
  913. tkName: this.posName, //题库名称
  914. tkAuthor: '门店介绍', //题库作者
  915. tkType: '外送', //题库类型
  916. cost: '自取', //是否需要收费 免费/付费
  917. isPub: '堂食' //公开 还是 私有
  918. };
  919. this.$refs.draw.share_qrcode(this.option);
  920. },
  921. shouchang() {
  922. this.showDownloadAppModal();
  923. },
  924. callPhone() {
  925. this.showDownloadAppModal();
  926. },
  927. gengduozx() {
  928. this.showDownloadAppModal();
  929. },
  930. pinglunList() {
  931. this.showDownloadAppModal();
  932. },
  933. fenleiSel(e) {
  934. console.log(e);
  935. this.current = e.detail.current;
  936. this.getmendianshangpinList(this.shangpinfenlei[this.current].id);
  937. this.itemId = 0;
  938. },
  939. shangpinsl(id) {
  940. //选择商品
  941. this.showDownloadAppModal();
  942. },
  943. gotoGouwuche() {
  944. this.showDownloadAppModal();
  945. },
  946. gotojiesuan() {
  947. this.showDownloadAppModal();
  948. },
  949. //pop------------------------------------------
  950. popfenlei() {
  951. if (this.shangpinfenlei.length > 0) {
  952. this.$refs.popfl.open('center');
  953. }
  954. },
  955. ppfenleisel(index) {
  956. this.current = index;
  957. this.$refs.popfl.close();
  958. this.getmendianshangpinList(this.shangpinfenlei[this.current].id);
  959. this.itemId = 0;
  960. },
  961. //------------------------------------
  962. addcollect() {
  963. if (!this.login) {
  964. uni.navigateTo({
  965. url: '/pages/UserCenter/LoginView'
  966. })
  967. }
  968. console.log('addcollect:id', this.id);
  969. api('addcollect', {
  970. mdid: this.id
  971. }, res => {
  972. console.log(res)
  973. if (this.isShouchang == 0) {
  974. this.isShouchang = 1;
  975. this.shouchangIcon = '/static/images/faverr@3x.png'
  976. } else {
  977. this.isShouchang = 0;
  978. this.shouchangIcon = '/static/images/faver@3x.png'
  979. }
  980. }, failc => {
  981. //console.log('getadvertis----',failc)
  982. })
  983. },
  984. getmendianDetail(id) {
  985. //console.log('getmendianDetail:id',id);
  986. uni.showLoading({
  987. mask: true
  988. })
  989. api('getmendianDetail', {
  990. id: id
  991. }, r => {
  992. console.log(r.data.data);
  993. uni.hideLoading();
  994. this.mendianMs = r.data.data;
  995. this.userid = this.mendianMs.userId;
  996. this.posName = this.mendianMs.posName;
  997. this.isShouchang = this.mendianMs.Collect;
  998. if (this.isShouchang == 1) {
  999. this.shouchangIcon = '/static/images/faverr@3x.png'
  1000. } else {
  1001. this.shouchangIcon = '/static/images/faver@3x.png'
  1002. }
  1003. this.getmendianshangpinFL(id);
  1004. // this.cuxiaoList();
  1005. }, failc => {
  1006. uni.hideLoading();
  1007. //console.log('getadvertis----',failc)
  1008. })
  1009. },
  1010. getmendianshangpinFL(id) {
  1011. uni.showLoading({
  1012. mask: true
  1013. })
  1014. api('getmendianshangpinFL', {
  1015. id: id,
  1016. language: this.lang
  1017. }, res => {
  1018. uni.hideLoading();
  1019. this.shangpinfenlei = res.data.data;
  1020. if (this.shangpinfenlei.length > 0) {
  1021. this.getmendianshangpinList(this.shangpinfenlei[0].id);
  1022. }
  1023. }, failc => {
  1024. uni.hideLoading();
  1025. //console.log('getadvertis----',failc)
  1026. })
  1027. },
  1028. getmendianshangpinList(id) {
  1029. uni.showLoading({
  1030. mask: true
  1031. })
  1032. console.log(this.lang)
  1033. api('getmendianshangpinList', {
  1034. id: id,
  1035. language: this.lang
  1036. }, r => {
  1037. console.log(r);
  1038. uni.hideLoading();
  1039. this.dowithshangpinList(r.data.data);
  1040. this.shangpinlist = r.data.data;
  1041. }, failc => {
  1042. uni.hideLoading();
  1043. //console.log('getadvertis----',failc)
  1044. })
  1045. },
  1046. dowithshangpinList(shangpinlist) {
  1047. if (this.shangpingoumaiS.length == 0) {
  1048. for (var i = 0; i < this.shangpinfenlei.length; i++) {
  1049. this.shangpingoumaiS.push([]);
  1050. }
  1051. }
  1052. this.shangpingoumaiS[this.current] = [];
  1053. if (shangpinlist) {
  1054. for (var j = 0; j < shangpinlist.length; j++) {
  1055. var shuliang = this.tongbugouwuchexinxi(shangpinlist[j]);
  1056. var otherPrice = this.getotherPrice(shangpinlist[j].foodSku);
  1057. var tempSKU = this.gettempSKU(shangpinlist[j].foodSku);
  1058. var tempsp = {
  1059. "shangpin": shangpinlist[j],
  1060. "sku": tempSKU,
  1061. "otherPrice": otherPrice,
  1062. "shuliang": shuliang
  1063. }
  1064. this.shangpingoumaiS[this.current].push(tempsp);
  1065. }
  1066. }
  1067. },
  1068. cuxiaoList() {
  1069. api('cuxiaoList', {
  1070. mdId: this.id,
  1071. price: ''
  1072. }, r => {
  1073. //console.log('-----------',r)
  1074. if (r.data.code == 200) {
  1075. this.cuxiaoImge = [];
  1076. var objs = r.data.data;
  1077. for (var i = 0; i < objs.length; i++) {
  1078. var obj = objs[i];
  1079. if (obj.poster && obj.poster.length > 0) {
  1080. this.cuxiaoImge.push(obj.poster);
  1081. }
  1082. }
  1083. }
  1084. }, failc => {
  1085. //console.log('getadvertis----',failc)
  1086. })
  1087. },
  1088. //--------------------------------------
  1089. tongjigouwuche() {
  1090. this.goumaijine = 0;
  1091. if (this.gouwuche.mendid == this.id) {
  1092. for (var j = 0; j < this.gouwuche.foodlist.length; j++) {
  1093. var sp = this.gouwuche.foodlist[j];
  1094. this.goumaijine = this.goumaijine + sp.number * (sp.price + sp.otherPrice);
  1095. }
  1096. }
  1097. this.jinger();
  1098. },
  1099. tongbugouwuchexinxi(sp) {
  1100. var tempshuliang = 0;
  1101. for (var i = 0; i < this.gouwuche.foodlist.length; i++) {
  1102. if (this.gouwuche.foodlist[i].id == sp.id) {
  1103. tempshuliang = tempshuliang + this.gouwuche.foodlist[i].number;
  1104. }
  1105. }
  1106. return tempshuliang;
  1107. },
  1108. refleashdata() {
  1109. var gwc = uni.getStorageSync('gouwuche');
  1110. if ('' == gwc || null == gwc || undefined == gwc) {
  1111. this.gouwuche = {
  1112. foodlist: [],
  1113. mendid: '',
  1114. userid: '',
  1115. mendname: ''
  1116. };
  1117. this.tongjigouwuche();
  1118. } else {
  1119. this.gouwuche = JSON.parse(gwc);
  1120. this.tongjigouwuche();
  1121. }
  1122. if (this.shangpinlist.length > 0) {
  1123. this.dowithshangpinList(this.shangpinlist);
  1124. }
  1125. },
  1126. jiangouwuche(e) {
  1127. //跳转购物车
  1128. this.showDownloadAppModal();
  1129. },
  1130. jiagouwuche(e) {
  1131. var gwc = uni.getStorageSync('gouwuche');
  1132. if ('' == gwc || null == gwc || undefined == gwc) {
  1133. this.gouwuche = {
  1134. foodlist: [],
  1135. mendid: '',
  1136. userid: '',
  1137. mendname: ''
  1138. };
  1139. } else {
  1140. this.gouwuche = JSON.parse(gwc);
  1141. }
  1142. this.dowithshangpinList(this.shangpinlist);
  1143. this.tongjigouwuche();
  1144. var temp = [];
  1145. for (var i = 0; i < this.shangpinlist.length; i++) {
  1146. temp.push(this.shangpinlist[i]);
  1147. }
  1148. this.shangpinlist = temp;
  1149. this.showpop = false;
  1150. },
  1151. jinger() {
  1152. if (this.goumaijine > 0) {
  1153. this.notext = this.$formPr(this.goumaijine) + this.$t('locale.huobidw');
  1154. console.log(this.notext);
  1155. this.gwbcolor = 'green';
  1156. this.gwbTcolor = 'white';
  1157. this.gouwcheimg = '/static/images/gouwu@3x.png';
  1158. this.showbt = true;
  1159. }
  1160. if (this.goumaijine == 0) {
  1161. this.gwbcolor = 'darkgray';
  1162. this.gwbTcolor = 'black';
  1163. this.notext = this.$t('comp.weixgsp');
  1164. this.gouwcheimg = '/static/images/gouwuh@3x.png';
  1165. this.showbt = false;
  1166. }
  1167. },
  1168. editSKU(index) {
  1169. this.showDownloadAppModal();
  1170. },
  1171. gettempSKU(foodSku) {
  1172. var selectsku = [];
  1173. for (var i = 0; i < foodSku.length; i++) {
  1174. if (foodSku[i].objects.length > 0) {
  1175. for (var j = 0; j < foodSku[i].objects.length; j++) {
  1176. if (foodSku[i].objects[j].state == 1) {
  1177. selectsku.push(foodSku[i].objects[j].name);
  1178. }
  1179. }
  1180. }
  1181. }
  1182. return selectsku;
  1183. },
  1184. getotherPrice(foodSku) {
  1185. var jiner = 0;
  1186. for (var i = 0; i < foodSku.length; i++) {
  1187. if (foodSku[i].objects.length > 0) {
  1188. for (var j = 0; j < foodSku[i].objects.length; j++) {
  1189. if (foodSku[i].objects[j].state == 1) {
  1190. jiner = jiner + parseFloat(foodSku[i].objects[j].price);
  1191. }
  1192. }
  1193. }
  1194. }
  1195. return parseFloat(jiner);
  1196. },
  1197. }
  1198. }
  1199. </script>
  1200. <style lang="scss" scoped>
  1201. page {
  1202. background-color: #F2F3F7;
  1203. }
  1204. .box {
  1205. height: 100upx;
  1206. line-height: 100upx;
  1207. text-align: center;
  1208. background-color: white;
  1209. }
  1210. .fixedTop {
  1211. position: fixed;
  1212. top: 140rpx;
  1213. left: 0;
  1214. right: 0;
  1215. z-index: 9999999;
  1216. }
  1217. .fixedTopios {
  1218. position: fixed;
  1219. top: 180rpx;
  1220. left: 0;
  1221. right: 0;
  1222. z-index: 9999999;
  1223. }
  1224. //-----------------------------
  1225. .nodetail {
  1226. width: 94%;
  1227. margin-left: 3%;
  1228. margin-top: -40rpx;
  1229. background-color: white;
  1230. border-radius: 10rpx;
  1231. }
  1232. .fenleiTitle {
  1233. padding-left: 16rpx;
  1234. padding-right: 16rpx;
  1235. line-height: 36rpx;
  1236. font-size: 28rpx;
  1237. border-radius: 20rpx;
  1238. color: darkgray;
  1239. background-color: white;
  1240. border: 1rpx solid darkgray;
  1241. }
  1242. .swiper-item {
  1243. flex: 1;
  1244. flex-direction: row;
  1245. padding-left: 30rpx;
  1246. font-size: 28rpx;
  1247. line-height: 60rpx;
  1248. text-align: left;
  1249. font-weight: bold;
  1250. text-decoration: underline;
  1251. }
  1252. .textdop1 {
  1253. width: 12rpx;
  1254. height: 12rpx;
  1255. background-color: #00A6FF;
  1256. border-radius: 6rpx;
  1257. margin-left: 10rpx;
  1258. }
  1259. .textdop2 {
  1260. width: 8rpx;
  1261. height: 8rpx;
  1262. background-color: #00A6FF;
  1263. border-radius: 4rpx;
  1264. margin-left: 10rpx;
  1265. }
  1266. .page-view {
  1267. background-color: #F2F3F7;
  1268. }
  1269. .item_list {
  1270. padding: 0 15rpx;
  1271. display: flex;
  1272. flex-wrap: wrap;
  1273. justify-content: flex-start;
  1274. .item_content {
  1275. width: 50%;
  1276. margin: 10rpx 0;
  1277. padding: 14rpx;
  1278. box-sizing: border-box;
  1279. }
  1280. }
  1281. .thumb-boxR {
  1282. width: 334rpx;
  1283. background-color: white;
  1284. }
  1285. .goodimage {
  1286. margin-top: 0rpx;
  1287. }
  1288. .detailtextV {
  1289. width: 90%;
  1290. height: 80rpx;
  1291. overflow: hidden;
  1292. text-overflow: ellipsis;
  1293. display: -webkit-box;
  1294. -webkit-line-clamp: 2;
  1295. -webkit-box-orient: vertical;
  1296. }
  1297. .rconten {
  1298. display: flex;
  1299. flex-direction: row;
  1300. align-items: center;
  1301. margin-left: auto;
  1302. justify-content: flex-end;
  1303. }
  1304. .actimgeCT {
  1305. position: fixed;
  1306. width: 94%;
  1307. left: 3%;
  1308. top: 100rpx;
  1309. z-index: 9;
  1310. }
  1311. .actimge {
  1312. width: 60rpx;
  1313. height: 60rpx;
  1314. }
  1315. .actimgezy {
  1316. width: 40rpx;
  1317. height: 40rpx;
  1318. }
  1319. .imageRJ {
  1320. width: 56rpx;
  1321. height: 56rpx;
  1322. margin-right: 8rpx;
  1323. }
  1324. .imageR {
  1325. width: 56rpx;
  1326. height: 56rpx;
  1327. margin-right: 30rpx;
  1328. }
  1329. .textR {
  1330. margin-left: 6rpx;
  1331. margin-right: 6rpx;
  1332. }
  1333. .msText {
  1334. width: 90%;
  1335. margin-top: 20rpx;
  1336. padding-left: 30rpx;
  1337. text-align: left;
  1338. font-size: 22rpx;
  1339. line-height: 32rpx;
  1340. }
  1341. .buyBT {
  1342. display: flex;
  1343. flex-direction: row;
  1344. justify-content: left;
  1345. align-items: center;
  1346. width: 100%;
  1347. }
  1348. .gouwuche {
  1349. width: 120rpx;
  1350. height: 120rpx;
  1351. }
  1352. .dianpuming {
  1353. font-size: 30rpx;
  1354. line-height: 32rpx;
  1355. height: 32rpx;
  1356. font-weight: bold;
  1357. overflow: hidden;
  1358. text-overflow: ellipsis;
  1359. /* #ifndef APP-PLUS-NVUE */
  1360. display: -webkit-box;
  1361. -webkit-line-clamp: 1;
  1362. -webkit-box-orient: vertical;
  1363. /* #endif */
  1364. }
  1365. .peisongsuoming {
  1366. font-size: 26rpx;
  1367. line-height: 38rpx;
  1368. height: 38rpx;
  1369. color: dimgray;
  1370. }
  1371. .bottomfloatV {
  1372. position: fixed;
  1373. flex-direction: row;
  1374. align-items: center;
  1375. left: 0;
  1376. right: 0;
  1377. bottom: 0;
  1378. z-index: 999;
  1379. background-color: whitesmoke;
  1380. height: 140rpx;
  1381. }
  1382. .qjs {
  1383. border-radius: 8rpx;
  1384. padding: 6rpx;
  1385. margin-left: auto;
  1386. margin-right: 30rpx;
  1387. font-size: 32rpx;
  1388. height: 40rpx;
  1389. line-height: 40rpx;
  1390. }
  1391. .fenleiitem {
  1392. text-align: center;
  1393. margin-top: 12rpx;
  1394. margin-bottom: 12rpx;
  1395. width: 660upx;
  1396. border-radius: 10rpx;
  1397. color: darkblue;
  1398. line-height: 54rpx;
  1399. font-size: 28rpx;
  1400. border: solid lavender;
  1401. border-width: 0px 0px 1rpx 0px;
  1402. }
  1403. .hongbaoFV {
  1404. position: fixed;
  1405. flex-direction: row;
  1406. align-items: center;
  1407. left: 50rpx;
  1408. top: 400rpx;
  1409. z-index: 9999;
  1410. height: 120rpx;
  1411. width: 120rpx;
  1412. }
  1413. .hongbaoImage {
  1414. height: 120rpx;
  1415. width: 120rpx;
  1416. }
  1417. .withpophbkq {
  1418. width: 80%;
  1419. }
  1420. /* 下载app弹窗样式 */
  1421. .download-popup-content {
  1422. width: 600rpx;
  1423. background-color: white;
  1424. border-radius: 16rpx;
  1425. overflow: hidden;
  1426. }
  1427. .download-popup-header {
  1428. display: flex;
  1429. flex-direction: row;
  1430. justify-content: space-between;
  1431. align-items: center;
  1432. padding: 40rpx 40rpx 20rpx 40rpx;
  1433. position: relative;
  1434. }
  1435. .download-popup-title {
  1436. font-size: 36rpx;
  1437. font-weight: bold;
  1438. color: #333;
  1439. text-align: center;
  1440. flex: 1;
  1441. }
  1442. .download-popup-close {
  1443. position: absolute;
  1444. right: 0;
  1445. top: 0;
  1446. width: 60rpx;
  1447. height: 60rpx;
  1448. display: flex;
  1449. align-items: center;
  1450. justify-content: center;
  1451. border-radius: 0 16rpx 0 8rpx;
  1452. background-color: #ff4444;
  1453. }
  1454. .close-icon {
  1455. font-size: 40rpx;
  1456. color: white;
  1457. line-height: 1;
  1458. }
  1459. .download-popup-body {
  1460. padding: 20rpx 40rpx 40rpx 40rpx;
  1461. text-align: center;
  1462. }
  1463. .download-popup-text {
  1464. font-size: 30rpx;
  1465. color: #666;
  1466. line-height: 1.5;
  1467. }
  1468. .download-popup-buttons {
  1469. display: flex;
  1470. flex-direction: row;
  1471. border-top: 1rpx solid #f0f0f0;
  1472. }
  1473. .download-popup-btn {
  1474. flex: 1;
  1475. height: 100rpx;
  1476. display: flex;
  1477. align-items: center;
  1478. justify-content: center;
  1479. position: relative;
  1480. }
  1481. .download-popup-btn:not(:last-child)::after {
  1482. content: '';
  1483. position: absolute;
  1484. right: 0;
  1485. top: 0;
  1486. bottom: 0;
  1487. width: 1rpx;
  1488. background-color: #f0f0f0;
  1489. }
  1490. .download-popup-btn-ios {
  1491. background-color: white;
  1492. }
  1493. .download-popup-btn-android {
  1494. background-color: white;
  1495. }
  1496. .download-popup-btn-text {
  1497. font-size: 32rpx;
  1498. }
  1499. .download-popup-btn-ios .download-popup-btn-text {
  1500. color: #666;
  1501. }
  1502. .download-popup-btn-android .download-popup-btn-text {
  1503. color: #007AFF;
  1504. font-weight: 500;
  1505. }
  1506. </style>