shangpinxiangqing.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <view>
  3. <customNav :shownav="true" :title="$t('index.goodsxq')" titledetl=""></customNav>
  4. <view class="contentColumn">
  5. <view>
  6. <!--<myImage class="imageV" :mysrc="shangpinImage" mymode="widthFix"></myImage>-->
  7. <!-- <image class="imageV" :src="shangpinImage" mode="scaleToFill" @error="imageError()"></image> -->
  8. <netImage width="750" height="750" :mysrc="shangpinImage" mymode="scaleToFill"></netImage>
  9. </view>
  10. <view class="contentColumn" style="margin-left: 4%;width: 92%;margin-top: 10rpx;">
  11. <view class="dianpuming">
  12. <text>{{shangpinxq.name}}</text>
  13. </view>
  14. </view>
  15. <view class="contentInRowS" style="margin-left: 4%;width: 92%;">
  16. <view class="">
  17. <text class="peisongsuoming">{{$formPr(shangpinxq.price)}}{{$t('locale.huobidw')}}</text>
  18. </view>
  19. <view v-if="shangpinxq.stackingUp==0" class="rconten">
  20. <image v-if="goumail>0" class="imageRJ" src="/static/meishi/jianh.png" mode="aspectFit" @click="jiangouwuche"></image>
  21. <text v-if="goumail>0" class="textR">{{goumail}}</text>
  22. <image class="imageR" src="/static/meishi/jiah.png" mode="aspectFit" @click="editSKU"></image>
  23. </view>
  24. <view v-if="shangpinxq.stackingUp==1" class="rconten">
  25. <text class="textR">{{$t('mend.yixiajia')}}</text>
  26. </view>
  27. </view>
  28. <!-- <danxuanlist style="width:100%;" :infolistD="infosku" :isedit="false" v-on:ElistDatachange="listDatachange"></danxuanlist> -->
  29. <view class="">
  30. <text class="xsxqt">{{$t('index.goodsxq')}}:</text>
  31. </view>
  32. <view class="contentColumn shangpinwenmiao">
  33. <text>{{shangpinxq.introduce}}</text>
  34. </view>
  35. </view>
  36. <view style="height: 170rpx;"></view>
  37. <view class="bottomfloatV">
  38. <view class="buyBT" @click="qujiesuan">
  39. <image class="gouwuche" :src="gouwcheimg" mode="aspectFit"></image>
  40. <text class="peisongsuoming">{{notext}}</text>
  41. <text class="qjs" :style="{backgroundColor:gwbcolor,color:gwbTcolor}">{{$t('comp.lijigoumai')}}</text>
  42. </view>
  43. </view>
  44. <popViewGG :show="showpop" :showbotom="false" :maskClosable="true" :isCancel="true" @chooseCancel="chooseCancel">
  45. <foodxuangou style="width:100%;" :food="spindexSP" v-on:Ejiagouwuche="jiagouwuche"></foodxuangou>
  46. </popViewGG>
  47. </view>
  48. </template>
  49. <script>
  50. import api from "@/pages/api/api.js"
  51. export default {
  52. data() {
  53. return {
  54. goumail:0,
  55. goumaijine:0,
  56. notext:this.$t('comp.weixgsp'),
  57. gwbcolor:'darkgray',
  58. gwbTcolor:'black',
  59. gouwcheimg:'/static/meishi/BuyS@3x.png',
  60. showbt:false,
  61. id:1,
  62. spindexSP:'',
  63. shangpinxq:[],
  64. shangpinImage:'',
  65. infosku:'',
  66. showpop:false,
  67. sku:[],
  68. selectsku:[],
  69. gouwuche:{
  70. foodlist:[],
  71. mendid:'',
  72. userId:'',
  73. mendname:''
  74. }
  75. }
  76. },
  77. onLoad(option) {
  78. this.id=option.id;
  79. },
  80. onShow() {
  81. var gwc = uni.getStorageSync('gouwuche');
  82. if(''==gwc||null==gwc||undefined==gwc){
  83. this.goumail = 0;
  84. this.gouwuche=[];
  85. }
  86. else{
  87. this.gouwuche = JSON.parse(gwc);
  88. }
  89. this.getGoodsDetail(this.id);
  90. // if(1!=this.isShangjia){
  91. // var webView = this.$mp.page.$getAppWebview();
  92. // webView.setTitleNViewButtonStyle(0,{
  93. // width: '0'
  94. // });
  95. // }
  96. },
  97. methods: {
  98. editSKU(index){
  99. var tempsp={
  100. "shangpin":this.shangpinxq,
  101. "sku":'',
  102. "otherPrice":'',
  103. "shuliang":0
  104. }
  105. this.spindexSP = tempsp;
  106. this.showpop=true;
  107. //this.$refs.popup.open();
  108. },
  109. jiagouwuche(){
  110. var gwc = uni.getStorageSync('gouwuche');
  111. if(''==gwc||null==gwc||undefined==gwc){
  112. this.gouwuche={
  113. foodlist:[],
  114. mendid:'',
  115. userid:'',
  116. mendname:''
  117. };
  118. }
  119. else{
  120. this.gouwuche = JSON.parse(gwc);
  121. }
  122. this.tongjigouwuche();
  123. this.showpop=false;
  124. },
  125. chooseCancel(){
  126. this.showpop=false;
  127. },
  128. jiangouwuche(){
  129. //跳转购物车
  130. uni.switchTab({
  131. url:'/pages/OrderList/buy/gouwuche'
  132. })
  133. },
  134. tongjigouwuche(){
  135. this.goumaijine = 0;
  136. this.goumail = 0;
  137. for(var i=0;i<this.gouwuche.length;i++){
  138. var item = this.gouwuche[i];
  139. var yidongjine=item.amount;
  140. this.goumaijine = this.goumaijine+yidongjine;
  141. if(item.mdId==this.shangpinxq.store.id){
  142. for(var j=0;j<item.food.length;j++){
  143. var sp = item.food[j];
  144. if(sp.id==this.shangpinxq.id){
  145. this.goumail = this.goumail + sp.number;
  146. }
  147. }
  148. }
  149. }
  150. this.jinerpand();
  151. },
  152. jinerpand(){
  153. console.log('jinerpand',this.goumaijine)
  154. if(this.goumaijine>0){
  155. this.gwbcolor='green';
  156. this.gwbTcolor='white';
  157. this.notext=this.$formPr(this.goumaijine)+this.$t('locale.huobidw');
  158. this.gouwcheimg='/static/meishi/BuyS@3x.png';
  159. this.showbt=true;
  160. }
  161. else{
  162. this.gwbcolor='darkgray';
  163. this.gwbTcolor='black';
  164. this.notext=this.$t('comp.weixgsp');
  165. this.gouwcheimg='/static/meishi/BuyS@3x.png';
  166. this.showbt=false;
  167. }
  168. },
  169. qujiesuan(){
  170. if(this.shangpinxq.store.state==1){
  171. uni.showToast({
  172. title: this.$t('mend.statedy'),
  173. icon: 'none',
  174. duration: 2500
  175. })
  176. return;
  177. }
  178. var that = this;
  179. if(!this.showbt){
  180. uni.showToast({
  181. title: that.$t('comp.qingxzsp'),
  182. icon: 'none',
  183. duration: 3500
  184. })
  185. return;
  186. }
  187. var token = uni.getStorageSync("token");
  188. if(token == '' || token == undefined || token == null){
  189. uni.navigateTo({
  190. url:'/pages/UserCenter/LoginView'
  191. })
  192. return;
  193. }
  194. var foodlist=[];
  195. if(this.gouwuche.mendid==this.shangpinxq.store.id){
  196. for(var j=0;j<this.gouwuche.foodlist.length;j++){
  197. var sp = this.gouwuche.foodlist[j];
  198. if(sp.id==this.shangpinxq.id){
  199. foodlist.push(sp);
  200. }
  201. }
  202. }
  203. uni.navigateTo({
  204. url:'/pages/OrderList/buy/dingdanjiesuan'
  205. })
  206. },
  207. getGoodsDetail(id){
  208. api('GoodsDetail',{
  209. id:id
  210. },r=>{
  211. this.shangpinxq=r.data.data;
  212. console.log(this.shangpinxq);
  213. this.shangpinImage=this.shangpinxq.image;
  214. this.tongjigouwuche();
  215. },failc=>{
  216. //console.log('getadvertis----',failc)
  217. })
  218. },
  219. }
  220. }
  221. </script>
  222. <style lang="scss">
  223. .imageV{
  224. width:750rpx;
  225. height: 750rpx;
  226. background-color:floralwhite;
  227. }
  228. .imageZ{
  229. width: 30rpx;
  230. height: 30rpx;
  231. }
  232. .imageRJ{
  233. width: 56rpx;
  234. height: 56rpx;
  235. margin-right: 8rpx;
  236. }
  237. .imageR{
  238. width: 56rpx;
  239. height: 56rpx;
  240. margin-right: 0rpx;
  241. }
  242. .textR{
  243. margin-left: 6rpx;
  244. margin-right: 6rpx;
  245. }
  246. .msText{
  247. width:92%;
  248. margin-top: 20rpx;
  249. margin-left: 4%;
  250. text-align: left;
  251. }
  252. .contensb{
  253. display: flex;
  254. flex-direction: row;
  255. justify-content:space-between;
  256. align-items: center;
  257. }
  258. .rconten{
  259. margin-left: auto;
  260. display:flex;
  261. flex-direction: row;
  262. align-items: center;
  263. }
  264. .buyBT{
  265. display:flex;
  266. flex-direction: row;
  267. justify-content:flex-start;
  268. align-items: center;
  269. width:100%;
  270. margin-top: 10rpx;
  271. }
  272. .dianpuming{
  273. font-size: 30rpx;
  274. line-height: 32rpx;
  275. font-weight: bold;
  276. }
  277. .peisongsuoming{
  278. font-size: 26rpx;
  279. line-height: 32rpx;
  280. color: dimgray;
  281. }
  282. .detailtextV{
  283. color: dimgray;
  284. font-size: 26rpx;
  285. width: 90%;
  286. }
  287. .skuViewCt{
  288. display: flex;
  289. flex-direction: column;
  290. justify-content:center;
  291. width: 100%;
  292. margin-top: 10rpx;
  293. }
  294. .contensbgg{
  295. display: flex;
  296. flex-wrap: wrap;
  297. justify-content:flex-start;
  298. align-items:center;
  299. }
  300. .guigeleixing{
  301. font-size: 26rpx;
  302. line-height: 40rpx;
  303. height: 40rpx;
  304. color: black;
  305. font-weight: bold;
  306. }
  307. .youhuixinxi{
  308. margin: 8rpx;
  309. padding: 4rpx;
  310. font-size: 26rpx;
  311. line-height: 54rpx;
  312. height: 54rpx;
  313. border: 2rpx solid lightgray;
  314. border-radius: 8rpx;
  315. }
  316. .xz{
  317. color: lightcoral;
  318. border: 2rpx solid lightcoral;
  319. border-radius: 8rpx;
  320. }
  321. .xiaoliang{
  322. margin-left: auto;
  323. margin-right: 30rpx;
  324. }
  325. .xsxqt{
  326. margin-top: 16rpx;
  327. padding-left: 30rpx;
  328. font-size: 30rpx;
  329. line-height: 80rpx;
  330. height: 80rpx;
  331. font-weight: bold;
  332. background-color:whitesmoke;
  333. }
  334. .shangpinwenmiao{
  335. width:92%;
  336. margin-left: 4%;
  337. font-size: 30rpx;
  338. }
  339. .bottomfloatV{
  340. position: fixed;
  341. flex-direction: row;
  342. align-items: center;
  343. left: 0;
  344. right: 0;
  345. bottom: 0;
  346. z-index: 999;
  347. background-color: whitesmoke;
  348. height: 130rpx;
  349. }
  350. .gouwuche{
  351. margin-left: 20rpx;
  352. width: 80rpx;
  353. height: 80rpx;
  354. }
  355. .qjs{
  356. border-radius: 30rpx;
  357. padding-left: 26rpx;
  358. padding-right: 26rpx;
  359. margin-left: auto;
  360. margin-right: 30rpx;
  361. font-size: 32rpx;
  362. height: 60rpx;
  363. line-height: 60rpx;
  364. }
  365. </style>