detail.vue 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118
  1. <template>
  2. <view class="content">
  3. <u-navbar title=" " @leftClick="leftClick" height="44px" bgColor="#F5F5F5" :placeholder="true">
  4. <view class="hflex acenter" slot="center">
  5. <view class="nav_item" @click="changeNav(1)" :class="nav_active == 1?'nav_active': '' ">商品</view>
  6. <view class="nav_item" @click="changeNav(2)" :class="nav_active == 2?'nav_active': '' ">详情</view>
  7. </view>
  8. </u-navbar>
  9. <view class="swiper">
  10. <u-swiper :list="pageData.cover" height="300" @change="e => currentNum = e.current" :autoplay="false" indicatorStyle="right: 20px">
  11. <view slot="indicator" class="indicator-num">
  12. <text class="indicator-num__text">{{ currentNum + 1 }}/{{ len >= 0 ? len : 0}}</text>
  13. </view>
  14. </u-swiper>
  15. </view>
  16. <view class="box">
  17. <view class="hflex acenter jbetween">
  18. <view class="price">¥{{pageData.price_selling}}</view>
  19. <view class="hflex acenter">
  20. <view class="vflex acenter" @click="collect">
  21. <u-icon name="star" color="#444444" size="20" v-if="pageData.is_collection == 0"></u-icon>
  22. <u-icon name="star-fill" color="#506DFF" size="20" v-else></u-icon>
  23. <view class="text_style1">收藏</view>
  24. </view>
  25. <view class="vflex acenter" style="margin-left: 42rpx;" @click="share('Poster1')">
  26. <image src="https://ship.shipcc.cn/common/share.png" class="bottom_img"></image>
  27. <view class="text_style1">分享</view>
  28. </view>
  29. </view>
  30. </view>
  31. <span class="" :class="more_show ? 'hflex aend' : ''">
  32. <text class="name" :class="more_show ? 'text_hide2' : ''">{{pageData.name}}</text>
  33. <u-icon name="arrow-down" color="#000" size="16" v-if="more_show" @click="changeShow"></u-icon>
  34. <image src="@/static/images/shop/arrow-up.png" alt="" @click="changeShow" v-if="!more_show && length > 32" style="width: 28rpx;height: 28rpx" />
  35. <!-- <u-icon name="arrow-up" color="#000" size="16" v-if="!more_show && length > 32" @click="changeShow"></u-icon> -->
  36. </span>
  37. </view>
  38. <view class="box">
  39. <view class="hflex acenter jbetween" @click="openNorm">
  40. <view class="hflex acenter">
  41. <view class="label">选择</view>
  42. <view class="text_style2">{{normStr?normStr:'选择规格'}}</view>
  43. </view>
  44. <u-icon name="arrow-right" color="#000" size="14"></u-icon>
  45. </view>
  46. <view class="hflex acenter jbetween pad-20" @click="openAddr">
  47. <view class="hflex acenter">
  48. <view class="label">配送</view>
  49. <view class="text_style2">{{delivery?delivery:'选择配送地址'}}</view>
  50. </view>
  51. <u-icon name="arrow-right" color="#000" size="14"></u-icon>
  52. </view>
  53. </view>
  54. <view class="box1">
  55. <view class="title">商品图文详情</view>
  56. <!-- <block v-for="(item,index) in pageData.detail" :key="index">
  57. <image :src="item" mode="widthFix" class="detail_img"></image>
  58. </block> -->
  59. <u-parse :content="pageData.content"></u-parse>
  60. <view class="vflex acenter jcenter">
  61. <view v-for="(item,index) in pageData.slider" :key="index" class="cell">
  62. <image :src="item.url" style="width: 100%;" mode="widthFix" v-if="item.type == 'img'"></image>
  63. <video :src="item.url" v-else></video>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="bottom hflex acenter jbetween">
  68. <view class="vflex acenter" @click="toShop">
  69. <image src="/static/images/shop/shop_icon.png" class="bottom_img"></image>
  70. <view class="text_style1">店铺</view>
  71. </view>
  72. <view class="vflex acenter" @click="into_chatroom">
  73. <image src="/static/images/shop/customer_icon.png" class="bottom_img"></image>
  74. <view class="text_style1">客服</view>
  75. <!-- <button class="text_style1" style="border: none;background: rgba(0, 0, 0, 0);" open-type="contact" @contact="handleContact">客服</button> -->
  76. </view>
  77. <view class="vflex acenter" @click="toCart">
  78. <image src="/static/images/shop/cart_icon.png" class="bottom_img"></image>
  79. <view class="text_style1">购物车</view>
  80. </view>
  81. <view class="hflex acenter" v-if="pageData.status != 0">
  82. <view class="btn1" @click="addCart">加入购物车</view>
  83. <view class="btn2" @click="buy">立即购买</view>
  84. </view>
  85. <view class="" v-if="pageData.status == 0">
  86. <view class="btn3">已下架</view>
  87. </view>
  88. </view>
  89. <u-popup :show="norm_show" @close="close" mode="bottom" :round="20" :closeable="true">
  90. <view class="popu">
  91. <view class="hflex acenter">
  92. <image :src="pageData.items[norm_active].show_image?pageData.items[norm_active].show_image:pageData.cover" class="popu_img" mode="aspectFill"></image>
  93. <view class="vflex jbetween popu_right">
  94. <view class="popu_price">¥{{pageData.items[norm_active].price_selling?pageData.items[norm_active].price_selling:pageData.price_selling}}</view>
  95. <view class="popu_norm text_hide">{{normStr?normStr:'选择规格'}}</view>
  96. </view>
  97. </view>
  98. <view class="" v-for="(item,index) in pageData.specs" :key="index">
  99. <view class="popu_title">{{item.name}}</view>
  100. <view class="hflex acenter fwrap">
  101. <block v-for="(item2,index2) in item.list" :key="index2">
  102. <view class="popu_box" @click="selectNorm(index,index2)" :class="item2.select?'sele_active':''" v-if="item2.show && item2.check">{{item2.name}}</view>
  103. <view class="popu_box popu_box2" v-else @click="selectNorm2">{{item2.name}}</view>
  104. </block>
  105. </view>
  106. </view>
  107. <view class="hflex acenter jbetween">
  108. <view class="popu_title">数量</view>
  109. <u-number-box v-model="pageData.num" @change="changeNum"></u-number-box>
  110. </view>
  111. <view class="sure_btn" @click="sure">确定</view>
  112. </view>
  113. </u-popup>
  114. <u-popup :show="addr_show" @close="close" mode="bottom" :round="20" :closeable="true">
  115. <view class="popu">
  116. <view class="hflex acenter jcenter popu_title" style="text-align: center;">配送地址</view>
  117. <view v-if="deliveryList.length > 0">
  118. <block v-for="(item,index) in deliveryList" :key="index">
  119. <view class="box_bg hflex acenter" @click="selectAddr(index)">
  120. <image v-if="item.checked == 1" src="/static/images/shop/checked.png" class="check_img"></image>
  121. <u-icon v-else name="map-fill" color="#b2b2b2" size="12"></u-icon>
  122. <view class="popu_right2">
  123. <view class="hflex acenter">
  124. <view class="popu_name">{{item.name}}</view>
  125. <view class="popu_phone">{{item.phone}}</view>
  126. </view>
  127. <view class="popu_addr">{{item.province}} {{item.city}} {{item.area}} {{item.address}}</view>
  128. </view>
  129. </view>
  130. </block>
  131. </view>
  132. <view class="address vflex acenter jcenter" v-else>
  133. <image src="/static/images/shop/no_addr.png" class="address_img"></image>
  134. <view class="address_text">暂无地址</view>
  135. </view>
  136. <view class="sure_btn" @click="select">选择其他收货地址</view>
  137. </view>
  138. </u-popup>
  139. <view class="share_content" :class="share_show?'':'share_content1'">
  140. <view class="share_box vflex">
  141. <image class="Poster1 cover" :data-enode="pageData.cover[0]" data-etype="image" :src="pageData.cover[0]"></image>
  142. <view class="Poster1 share_price" :data-enode="'¥' + pageData.price_selling">¥{{pageData.price_selling}}</view>
  143. <view class="Poster1 share_name text_hide" :data-enode="pageData.name">{{pageData.name}}</view>
  144. <view class="hflex acenter share_text jcenter Poster1" style=" margin: 0 200rpx 12rpx;" data-enode="长按或扫码查看">长按或扫码查看</view>
  145. <view style="width: 100%;" class="vflex acenter jcenter">
  146. <image class="Poster1" style="width: 25rpx;height: 20rpx;" :data-enode="style.img1" data-etype="image" :src="style.img1"></image>
  147. <image class="Poster1" style="width: 100%;height: 2rpx;margin: 30rpx 0;" :data-enode="style.img2" data-etype="image" :src="style.img2"></image>
  148. </view>
  149. <view class="hflex acenter jbetween">
  150. <view class="vflex">
  151. <view class="share_name Poster1" style="margin: 54rpx 20rpx 20rpx;" data-enode="船百知">船百知</view>
  152. <view class="share_text Poster1" style="margin: 0 20rpx 36rpx;" data-enode="船百知伴你一起杨帆启航,驶向成功彼岸">船百知伴你一起杨帆启航,驶向成功彼岸</view>
  153. </view>
  154. <image class="Poster1" data-etype="image" :data-enode="style.code" :src="style.code" style="width: 136rpx;height: 136rpx;"></image>
  155. </view>
  156. </view>
  157. <evils-el-poster width="325" height="520" @on-error="onError" :list="list" backgroundColor="rgb(255, 255, 255)" @on-success="onSuccess" ref="Eposter"></evils-el-poster>
  158. <view class="share_bottom">
  159. <view class="hflex acenter jcenter">
  160. <button class="vflex acenter jcenter bottom_item" open-type="share">
  161. <image src="https://ship.shipcc.cn/common/wx.png" class="item_icon"></image>
  162. <view class="item_text">微信好友</view>
  163. </button>
  164. <!-- <button class="vflex acenter jcenter bottom_item" open-type="share">
  165. <image src="https://ship.shipcc.cn/common/moments.png" class="item_icon"></image>
  166. <view class="item_text">朋友圈</view>
  167. </button> -->
  168. <view class="vflex acenter jcenter bottom_item" @click="saveImg">
  169. <image src="https://ship.shipcc.cn/common/download.png" class="item_icon"></image>
  170. <view class="item_text">保存图片</view>
  171. </view>
  172. </view>
  173. <view class="share_cancel" @click="closed">取消</view>
  174. </view>
  175. </view>
  176. </view>
  177. </template>
  178. <script>
  179. import $api from '@/static/js/api.js'
  180. var that = ''
  181. export default {
  182. data() {
  183. return {
  184. nav_active: 1,
  185. currentNum: 0,
  186. pageData: {},
  187. normStr: '',
  188. norm: '',
  189. color: '',
  190. delivery: '',
  191. deliveryList: [],
  192. address_active: 0,
  193. norm_show: false,
  194. addr_show: false,
  195. norm_active: -1,
  196. color_active:-1,
  197. is_buy: 0,
  198. id: '',
  199. order_no: '',
  200. list: [],
  201. style: {
  202. img1: 'https://ship.shipcc.cn/common/down2.png',
  203. img2: 'https://ship.shipcc.cn/common/line.png',
  204. code: 'https://ship.shipcc.cn/common/code.jpg'
  205. },
  206. share_show: false,
  207. tempImage:'',
  208. item_id: '',
  209. normType: 0,
  210. len: 0,
  211. max_num: 1,
  212. more_show: false,
  213. length: 0
  214. }
  215. },
  216. onLoad(options) {
  217. that = this
  218. that.id = options.id
  219. that.getData()
  220. },
  221. onShow() {
  222. that.getAddr()
  223. },
  224. onPageScroll(e) {
  225. if(e.scrollTop < 530) {
  226. that.nav_active = 1
  227. } else {
  228. that.nav_active = 2
  229. }
  230. },
  231. onShareAppMessage(res) {
  232. console.log(res);
  233. if (res.from === 'button') {// 来自页面内分享按钮
  234. console.log(res.target)
  235. }
  236. return {
  237. title: '船百知', //分享的名称
  238. }
  239. },
  240. onShareTimeline(res) {
  241. console.log(res);
  242. return {
  243. title: '船百知',
  244. type: 0,
  245. summary: "",
  246. }
  247. },
  248. methods: {
  249. getData() {
  250. $api.req({
  251. url: '/data/api.Goods/Goods_info',
  252. data: {
  253. goods_id: that.id
  254. }
  255. }, function(res) {
  256. if(res.code == 1) {
  257. that.pageData = res.data
  258. var slider = []
  259. that.pageData.cover = that.pageData.cover.split('|')
  260. that.len = that.pageData.cover.length
  261. for(var i=0;i<that.pageData.slider.length;i++) {
  262. var temp = that.pageData.slider[i].substr(-3,3)
  263. var sliders = ''
  264. if(temp == 'jpg' || temp == "png") {
  265. sliders = "img"
  266. } else {
  267. sliders = 'video'
  268. }
  269. console.log(sliders);
  270. var data = {
  271. type: sliders,
  272. url: that.pageData.slider[i]
  273. }
  274. slider.push(data)
  275. }
  276. that.length = that.pageData.name.length
  277. console.log('字符长度',that.length);
  278. if(that.pageData.name.length > 32) {
  279. that.more_show = true
  280. }
  281. that.pageData.slider = slider
  282. console.log(that.pageData);
  283. that.$set(that.pageData,'num',1)
  284. }
  285. })
  286. },
  287. getAddr() {
  288. $api.req({
  289. url: '/data/api.User/address_list'
  290. }, function(res) {
  291. if(res.code == 1) {
  292. that.deliveryList = res.data.data
  293. var address_id = uni.getStorageSync('address_id')
  294. for(var i=0;i<that.deliveryList.length;i++) {
  295. if(that.deliveryList[i].id == address_id) {
  296. that.delivery = that.deliveryList[i].province+that.deliveryList[i].city+that.deliveryList[i].area
  297. that.$set(that.deliveryList[i],'checked',true)
  298. that.address_active = i
  299. } else {
  300. that.$set(that.deliveryList[i],'checked',false)
  301. }
  302. }
  303. }
  304. })
  305. },
  306. // 返回
  307. leftClick() {
  308. $api.jump(-1)
  309. },
  310. // 切换导航栏
  311. changeNav(index) {
  312. that.nav_active = index
  313. if(index == 1) {
  314. uni.pageScrollTo({
  315. scrollTop: 0,
  316. duration: 300
  317. });
  318. } else {
  319. uni.pageScrollTo({
  320. scrollTop: 530,
  321. duration: 300
  322. });
  323. }
  324. },
  325. changeShow() {
  326. that.more_show = !that.more_show
  327. },
  328. // 收藏
  329. collect() {
  330. if(that.pageData.is_collection == 0) {
  331. that.pageData.is_collection = 1
  332. $api.req({
  333. url: '/data/api.Goods/collection',
  334. data: {
  335. goods_id: that.pageData.id,
  336. }
  337. }, function(res) {
  338. if(res.code == 1) {
  339. $api.info(res.info)
  340. }
  341. })
  342. // $api.info('收藏成功')
  343. } else {
  344. that.pageData.is_collection = 0
  345. $api.req({
  346. url: '/data/api.Goods/cancel_collection',
  347. data: {
  348. goods_id: that.pageData.id,
  349. }
  350. }, function(res) {
  351. if(res.code == 1) {
  352. $api.info(res.info)
  353. }
  354. })
  355. }
  356. },
  357. share(elClass) {
  358. let view = uni.createSelectorQuery().in(this).select(".Poster1");
  359. view.fields({
  360. size: true,
  361. rect: true,
  362. scrollOffset: true
  363. }, data => {
  364. }).exec();
  365. that.share_show = true
  366. that.$refs.Eposter.createForElRect(elClass,false)
  367. },
  368. // 打开规格
  369. openNorm() {
  370. that.norm_show = true
  371. that.normType = 1
  372. },
  373. // 打开配送
  374. openAddr() {
  375. that.addr_show = true
  376. },
  377. // 选择规格
  378. selectNorm(index,index2) {
  379. for(var i=0;i<that.pageData.specs[index].list.length;i++) {
  380. if(i == index2) {
  381. that.$set(that.pageData.specs[index].list[i],'select',true)
  382. } else {
  383. that.$set(that.pageData.specs[index].list[i],'select',false)
  384. }
  385. }
  386. that.normStr = ''
  387. that.item_id = ''
  388. for(var i=0;i<that.pageData.specs.length;i++) {
  389. for(var j=0;j<that.pageData.specs[i].list.length;j++) {
  390. if(that.pageData.specs[i].list[j].select) {
  391. that.normStr += that.pageData.specs[i].name+'::'+that.pageData.specs[i].list[j].name+';;'
  392. // that.item_id +=
  393. }
  394. }
  395. }
  396. that.normStr = that.normStr.substring(0, that.normStr.length-2)
  397. for(var i=0;i<that.pageData.items.length;i++) {
  398. if(that.pageData.items[i].goods_spec == that.normStr) {
  399. that.norm_active = i
  400. that.max_num = that.pageData.items[that.norm_active].stock_total
  401. that.normStr = $api.resetspec(that.normStr)
  402. return
  403. } else {
  404. that.norm_active = -1
  405. }
  406. }
  407. that.normStr = $api.resetspec(that.normStr)
  408. // that.norm_active = index2
  409. // that.normStr = that.pageData.items[index].goods_spec
  410. // that.normStr = that.norm + ' ' + that.color + ' ' + 'X' + that.pageData.norm.num
  411. },
  412. selectNorm2() {
  413. $api.info('该规格已下架,请重新选择')
  414. },
  415. // 选择颜色
  416. selectColor(index) {
  417. that.color_active = index
  418. that.color = that.pageData.norm.colorList[index].name
  419. that.normStr = that.norm + ' ' + that.color + ' ' + 'X' + that.pageData.norm.num
  420. },
  421. // 选择数量
  422. changeNum(e) {
  423. that.pageData.num = e.value
  424. },
  425. // 选择地址
  426. selectAddr(index) {
  427. for(var i=0;i<that.deliveryList.length;i++) {
  428. if(i == index) {
  429. console.log(i);
  430. that.$set(that.deliveryList[i],'checked',1)
  431. that.address_active = i
  432. that.delivery = that.deliveryList[i].province+that.deliveryList[i].city+that.deliveryList[i].area + that.deliveryList[i].address
  433. that.close()
  434. } else {
  435. that.$set(that.deliveryList[i],'checked',0)
  436. }
  437. }
  438. },
  439. // 加入购物车
  440. addCart() {
  441. if(that.max_num < that.pageData.num) {
  442. $api.info("商品库存不足")
  443. return
  444. }
  445. if(that.norm == '' && that.color == '') {
  446. that.is_buy = 0
  447. that.norm_show = true
  448. // that.openNorm()
  449. } else {
  450. $api.req({
  451. url: '/data/api.Goods/cart_add',
  452. method: 'POST',
  453. data: {
  454. admin_id: that.pageData.admin_id,
  455. goods_id: that.pageData.id,
  456. item_id: that.pageData.items[that.norm_active].id,
  457. num: that.pageData.num
  458. }
  459. }, function(res) {
  460. if(res.code == 1) {
  461. $api.info('加入购物车成功')
  462. that.close()
  463. }
  464. })
  465. }
  466. },
  467. // 立即购买
  468. buy() {
  469. /* if(that.deliveryList.length == 0) {
  470. $api.info('请先选择配送地址')
  471. return
  472. } */
  473. if(that.max_num < that.pageData.num) {
  474. $api.info("商品库存不足")
  475. return
  476. }
  477. console.log(that.norm_active);
  478. if(that.norm_active == -1) {
  479. that.is_buy = 1
  480. that.norm_show = true
  481. } else {
  482. var url = ''
  483. var data = {
  484. admin_id: that.pageData.admin_id,
  485. admin_name: that.pageData.admin_name,
  486. code: that.pageData.code,
  487. create_at: that.pageData.create_at,
  488. cover: that.pageData.cover,
  489. id: that.pageData.id,
  490. items: that.pageData.items,
  491. name: that.pageData.name,
  492. num_read: that.pageData.num_read,
  493. price_selling: that.pageData.price_selling,
  494. price_market: that.pageData.price_market,
  495. }
  496. if(that.deliveryList.length>0) {
  497. url = '/page_shop/pages/good/submit?pageData=' + JSON.stringify(data) + '&item_id=' + that.norm_active + '&buy_num=' + that.pageData.num + '&address_id=' + that.deliveryList[that.address_active].id
  498. } else {
  499. url = '/page_shop/pages/good/submit?pageData=' + JSON.stringify(data) + '&item_id=' + that.norm_active + '&buy_num=' + that.pageData.num
  500. }
  501. $api.jump(url)
  502. }
  503. },
  504. // 确定选择规格
  505. sure() {
  506. if(that.norm_active == -1) {
  507. $api.info('请先选择规格')
  508. return
  509. }
  510. if(that.max_num < that.pageData.num) {
  511. $api.info("商品库存不足")
  512. return
  513. }
  514. for(var i=0;i<that.pageData.specs.length;i++) {
  515. for(var j=0;j<that.pageData.specs[i].list.length;j++) {
  516. if(!that.pageData.specs[i].list[j].select && that.norm_active == -1) {
  517. $api.info('该规格已下架,请重新选择')
  518. return
  519. }
  520. }
  521. }
  522. console.log(that.norm_active);
  523. if(that.normType == 1) {
  524. that.close()
  525. return
  526. }
  527. if(that.is_buy == 0) {
  528. $api.req({
  529. url: '/data/api.Goods/cart_add',
  530. method: 'POST',
  531. data: {
  532. admin_id: that.pageData.admin_id,
  533. goods_id: that.pageData.id,
  534. item_id: that.pageData.items[that.norm_active].id,
  535. num: that.pageData.num
  536. }
  537. }, function(res) {
  538. if(res.code == 1) {
  539. $api.info('加入购物车成功')
  540. // that.norm_active = -1
  541. that.close()
  542. }
  543. })
  544. } else {
  545. var url = ''
  546. var data = {
  547. admin_id: that.pageData.admin_id,
  548. admin_name: that.pageData.admin_name,
  549. code: that.pageData.code,
  550. create_at: that.pageData.create_at,
  551. cover: that.pageData.cover,
  552. id: that.pageData.id,
  553. items: that.pageData.items,
  554. name: that.pageData.name,
  555. num_read: that.pageData.num_read,
  556. price_selling: that.pageData.price_selling,
  557. price_market: that.pageData.price_market,
  558. }
  559. if(that.deliveryList.length>0) {
  560. url = '/page_shop/pages/good/submit?pageData=' + JSON.stringify(data) + '&item_id=' + that.norm_active + '&buy_num=' + that.pageData.num + '&address_id=' + that.deliveryList[that.address_active].id
  561. } else {
  562. url = '/page_shop/pages/good/submit?pageData=' + JSON.stringify(data) + '&item_id=' + that.norm_active + '&buy_num=' + that.pageData.num
  563. }
  564. $api.jump(url)
  565. that.close()
  566. /* if(that.deliveryList.length == 0) {
  567. $api.info('请先选择配送地址')
  568. return
  569. }
  570. $api.req({
  571. url: '/data/api.Order/order_create',
  572. method: 'POST',
  573. data: {
  574. admin_id: that.pageData.admin_id,
  575. item_id: that.pageData.items[that.norm_active].id,
  576. num: that.pageData.num,
  577. address_id: that.deliveryList[that.address_active].id
  578. }
  579. }, function(res) {
  580. if(res.code == 1) {
  581. $api.info(res.info)
  582. that.close()
  583. var order_id = res.data.order_id
  584. var pay_no = res.data.pay_no
  585. $api.jump('/page_shop/pages/good/submit?order_id=' + order_id + '&address_id=' + that.deliveryList[that.address_active].id + '&pay_no= ' +pay_no)
  586. }
  587. }) */
  588. }
  589. },
  590. // 关闭弹窗
  591. close() {
  592. that.norm_show = false
  593. that.addr_show = false
  594. that.normType = 0
  595. },
  596. closed() {
  597. that.share_show = false
  598. },
  599. // 选择其他收货地址
  600. select() {
  601. $api.jump('/page_shop/pages/address/list?select=true')
  602. },
  603. // 店铺
  604. toShop() {
  605. $api.jump('/page_shop/pages/good/shop?id=' + that.pageData.admin_id)
  606. },
  607. into_chatroom() {
  608. var my = uni.getStorageSync("myUsername");
  609. var nameList = {
  610. myName: my,
  611. your: that.pageData.huanxinID,
  612. };
  613. uni.navigateTo({
  614. url: "/pages/chatroom/chatroom?username=" + JSON.stringify(nameList),
  615. });
  616. },
  617. // 购物车
  618. toCart() {
  619. $api.jump('/page_shop/pages/mine/cart')
  620. },
  621. onSuccess(e) {
  622. console.log(e);
  623. that.tempImage = e
  624. },
  625. onError(err) {
  626. console.log('发生错误');
  627. console.log(err);
  628. },
  629. saveImg() {
  630. console.log(that.tempImage);
  631. uni.authorize({
  632. scope: 'scope.writePhotosAlbum',
  633. success() {
  634. uni.saveImageToPhotosAlbum({
  635. filePath: that.tempImage,
  636. success: function () {
  637. console.log('save success');
  638. $api.info('保存成功')
  639. that.close()
  640. }
  641. });
  642. }
  643. })
  644. },
  645. },
  646. }
  647. </script>
  648. <style lang="scss" scoped>
  649. .content::v-deep {
  650. background: #F5F5F5;
  651. .nav_item {
  652. font-size: 32rpx;
  653. font-weight: 500;
  654. color: #999999;
  655. line-height: 50rpx;
  656. margin-right: 88rpx;
  657. }
  658. .nav_active {
  659. color: #222222;
  660. position: relative;
  661. }
  662. .nav_active::after {
  663. content: "";
  664. position: absolute;
  665. bottom: -8rpx;
  666. left: 11rpx;
  667. width: 40rpx;
  668. height: 8rpx;
  669. background: #506DFF;
  670. border-radius: 6rpx;
  671. }
  672. .swiper {
  673. width: 690rpx;
  674. margin: 0 auto 10rpx;
  675. .indicator {
  676. @include flex(row);
  677. justify-content: center;
  678. }
  679. .indicator-num {
  680. padding: 4rpx 0;
  681. background-color: rgba(0, 0, 0, 0.6);
  682. border-radius: 20rpx;
  683. width: 72rpx;
  684. @include flex;
  685. justify-content: center;
  686. &__text {
  687. color: #FFFFFF;
  688. font-size: 24rpx;
  689. font-weight: 400;
  690. line-height: 30rpx;
  691. }
  692. }
  693. }
  694. .box {
  695. margin: 10rpx auto;
  696. width: 690rpx;
  697. background: #FFFFFF;
  698. border-radius: 16rpx;
  699. box-sizing: border-box;
  700. padding: 26rpx 20rpx;
  701. .price {
  702. font-size: 32rpx;
  703. font-weight: bold;
  704. color: #FF5959;
  705. line-height: 38rpx;
  706. }
  707. .name {
  708. margin-top: 20rpx;
  709. font-size: 36rpx;
  710. font-weight: 500;
  711. color: #222222;
  712. }
  713. .bottom_img {
  714. width: 40rpx;
  715. height: 40rpx;
  716. }
  717. .pad-20 {
  718. padding: 40rpx 0 0;
  719. }
  720. .label {
  721. font-size: 26rpx;
  722. font-weight: 400;
  723. color: #979797;
  724. line-height: 36rpx;
  725. padding-right: 32rpx;
  726. }
  727. .text_style2 {
  728. font-size: 26rpx;
  729. font-weight: 400;
  730. color: #333333;
  731. line-height: 36rpx;
  732. }
  733. }
  734. .box1 {
  735. width: 690rpx;
  736. background: #FFFFFF; border-radius: 16rpx;
  737. margin: 10rpx auto 186rpx;
  738. box-sizing: border-box;
  739. padding: 26rpx 20rpx;
  740. .title {
  741. font-size: 30rpx;
  742. font-weight: 400;
  743. color: #222222;
  744. line-height: 42rpx;
  745. width: 100%;
  746. text-align: center;
  747. padding: 30rpx 0;
  748. }
  749. .cell {
  750. width: 100%;
  751. margin-top: 5rpx;
  752. }
  753. .detail_img {
  754. width: 100%;
  755. padding-bottom: 20rpx;
  756. }
  757. }
  758. .text_style1 {
  759. font-size: 20rpx;
  760. font-weight: 400;
  761. color: #444444;
  762. margin-top: 6rpx;
  763. }
  764. button {
  765. line-height: unset;
  766. }
  767. button::after {
  768. border: none;
  769. }
  770. .bottom {
  771. width: 100%;
  772. // z-index: 9;
  773. position: fixed;
  774. bottom: 0;
  775. height: 166rpx;
  776. background: #FFFFFF;
  777. box-sizing: border-box;
  778. padding: 8rpx 30rpx 74rpx;
  779. .btn1 {
  780. width: 220rpx;
  781. height: 72rpx;
  782. background: #FFCA43;
  783. border-radius: 38rpx 0px 0px 38rpx;
  784. font-size: 28rpx;
  785. font-weight: 500;
  786. color: #FFFFFF;
  787. text-align: center;
  788. line-height: 72rpx;
  789. }
  790. .btn2 {
  791. width: 220rpx;
  792. height: 72rpx;
  793. background: #506DFF;
  794. border-radius: 0px 38rpx 38rpx 0px;
  795. font-size: 28rpx;
  796. font-weight: 500;
  797. color: #FFFFFF;
  798. text-align: center;
  799. line-height: 72rpx;
  800. }
  801. .btn3 {
  802. background: #CFCFCF;
  803. border-radius: 36rpx;
  804. font-size: 28rpx;
  805. font-family: PingFangSC-Medium, PingFang SC;
  806. font-weight: 500;
  807. color: #FFFFFF;
  808. text-align: center;
  809. line-height: 72rpx;
  810. width: 440rpx;
  811. height: 72rpx;
  812. }
  813. .bottom_img {
  814. width: 40rpx;
  815. height: 40rpx;
  816. }
  817. }
  818. .popu {
  819. background: #FFFFFF;
  820. box-sizing: border-box;
  821. padding: 48rpx 30rpx;
  822. .popu_img {
  823. width: 160rpx;
  824. height: 160rpx;
  825. border-radius: 12rpx;
  826. margin-right: 20rpx;
  827. }
  828. .popu_right {
  829. height: 124rpx;
  830. margin: 20rpx 0 16rpx;
  831. .popu_price {
  832. font-size: 28rpx;
  833. font-weight: 400;
  834. color: #FF4747;
  835. line-height: 34rpx;
  836. }
  837. .popu_norm {
  838. max-width: 450rpx;
  839. font-size: 24rpx;
  840. font-weight: 400;
  841. color: #A7A7A7;
  842. line-height: 34rpx;
  843. }
  844. }
  845. .popu_title {
  846. font-size: 28rpx;
  847. font-weight: 600;
  848. color: #222222;
  849. line-height: 40rpx;
  850. margin: 15rpx 0;
  851. text-overflow: ellipsis;
  852. overflow: hidden;
  853. display: -webkit-box;
  854. -webkit-box-orient: vertical;
  855. box-orient: vertical;
  856. line-clamp: 2;
  857. -webkit-line-clamp: 2;
  858. }
  859. .address {
  860. .address_img {
  861. width: 200rpx;
  862. height: 200rpx;
  863. border-radius: 50%;
  864. margin-bottom: 20rpx;
  865. }
  866. .address_text {
  867. text-align: center;
  868. font-size: 28rpx;
  869. color: #222222;
  870. line-height: 40rpx;
  871. }
  872. }
  873. .box_bg {
  874. background: #F5F5F5;
  875. border-radius: 16rpx;
  876. box-sizing: border-box;
  877. padding: 24rpx 20rpx;
  878. margin: 10rpx 0;
  879. .check_img {
  880. width: 24rpx;
  881. height: 24rpx;
  882. }
  883. .popu_right2 {
  884. padding-left: 30rpx;
  885. .popu_name {
  886. font-size: 28rpx;
  887. font-weight: 500;
  888. color: #222222;
  889. line-height: 40rpx;
  890. }
  891. .popu_phone {
  892. padding-left: 16rpx;
  893. font-size: 22rpx;
  894. font-weight: 400;
  895. color: #999999;
  896. line-height: 16px;
  897. }
  898. .popu_addr {
  899. padding: 16rpx 0 0;
  900. font-size: 24rpx;
  901. font-weight: 400;
  902. color: #444444;
  903. line-height: 34rpx;
  904. }
  905. }
  906. }
  907. .popu_box {
  908. background: #F4F4F4;
  909. border-radius: 8rpx;
  910. font-size: 26rpx;
  911. font-weight: 400;
  912. color: #222222;
  913. line-height: 36rpx;
  914. padding: 7rpx 36rpx;
  915. margin: 0 22rpx 28rpx 0;
  916. text-overflow: ellipsis;
  917. overflow: hidden;
  918. display: -webkit-box;
  919. -webkit-box-orient: vertical;
  920. box-orient: vertical;
  921. line-clamp: 2;
  922. -webkit-line-clamp: 2;
  923. }
  924. .popu_box2 {
  925. background-color: #5b5b5b;
  926. }
  927. // .popu_box:nth-child(4n+4) {
  928. // margin: 0 0 28rpx 0;
  929. // }
  930. .sele_active {
  931. background: #F1F4FF;
  932. border: 1px solid #5471FF;
  933. color: #506DFF;
  934. }
  935. .sure_btn {
  936. width: 100%;
  937. height: 84rpx;
  938. background: #506DFF;
  939. border-radius: 42rpx;
  940. font-size: 36rpx;
  941. font-weight: 500;
  942. color: #FFFFFF;
  943. line-height: 84rpx;
  944. text-align: center;
  945. margin-top: 94rpx;
  946. }
  947. }
  948. .share_content {
  949. position: fixed;
  950. top: 0;
  951. left: 0;
  952. z-index: 99;
  953. width: 100vw;
  954. height: 100vh;
  955. background: rgba(0,0,0,0.5);
  956. backdrop-filter: blur(5px);
  957. padding: 0 0 0;
  958. .cover {
  959. width: 100%;
  960. margin: 0 auto;
  961. height: 520rpx;
  962. // opacity:0
  963. }
  964. .share_price {
  965. font-size: 28rpx;
  966. font-weight: 400;
  967. color: #FF5959;
  968. line-height: 34rpx;
  969. margin: 6rpx 20rpx 12rpx;
  970. }
  971. .share_box {
  972. // margin: 130rpx auto 0;
  973. // width: 650rpx;
  974. // background: #FFFFFF;
  975. // border-radius: 20rpx;
  976. // box-sizing: border-box;
  977. // z-index: -999;
  978. // // opacity: 0;
  979. // padding: 0 40rpx;
  980. margin: 130rpx auto 0;
  981. width: 650rpx;
  982. background: #FFFFFF;
  983. border-radius: 20rpx;
  984. box-sizing: border-box;
  985. padding: 48rpx 35rpx 0;
  986. .share_name {
  987. max-width: 500rpx;
  988. font-size: 30rpx;
  989. font-weight: 400;
  990. color: #222222;
  991. line-height: 42rpx;
  992. margin: 0 20rpx 44rpx;
  993. }
  994. .share_label {
  995. width: 100%;
  996. font-size: 28rpx;
  997. font-weight: 400;
  998. color: #222222;
  999. line-height: 40rpx;
  1000. }
  1001. .share_text {
  1002. width: 100%;
  1003. font-size: 24rpx;
  1004. font-weight: 400;
  1005. color: #999999;
  1006. line-height: 34rpx;
  1007. text-overflow: ellipsis;
  1008. overflow: hidden;
  1009. display: -webkit-box;
  1010. -webkit-box-orient: vertical;
  1011. box-orient: vertical;
  1012. line-clamp: 5;
  1013. -webkit-line-clamp: 5;
  1014. }
  1015. .box_bottom {
  1016. width: 100%;
  1017. padding: 34rpx 0 16rpx;
  1018. border-top: 1rpx dashed #C3C3C3;
  1019. .bottom_left1 {
  1020. font-size: 32rpx;
  1021. font-weight: 500;
  1022. color: #222222;
  1023. line-height: 44rpx;
  1024. padding-bottom: 20rpx;
  1025. }
  1026. .bottom_left2 {
  1027. font-size: 22rpx;
  1028. font-weight: 400;
  1029. color: #999999;
  1030. line-height: 32rpx;
  1031. }
  1032. .bottom_right {
  1033. width: 136rpx;
  1034. height: 136rpx;
  1035. }
  1036. }
  1037. }
  1038. /* .canvas2 {
  1039. position: absolute;
  1040. top: 188rpx;
  1041. left: 50rpx;
  1042. width: 650rpx;
  1043. min-height: 494rpx;
  1044. background: #FFFFFF;
  1045. border-radius: 20rpx;
  1046. // z-index: 9;
  1047. } */
  1048. .share_bottom {
  1049. position: fixed;
  1050. bottom: 0;
  1051. width: 100%;
  1052. height: 388rpx;
  1053. background: #F5F7FF;
  1054. border-radius: 40rpx 40rpx 0px 0px;
  1055. z-index: 99;
  1056. .bottom_item {
  1057. width: 33%;
  1058. margin: 50rpx 0 90rpx;
  1059. border: none !important;
  1060. background-color: #F5F7FF !important;
  1061. .item_icon {
  1062. width: 76rpx;
  1063. height: 76rpx;
  1064. }
  1065. .item_text {
  1066. font-size: 26rpx;
  1067. font-weight: 400;
  1068. color: #333333;
  1069. line-height: 36rpx;
  1070. margin-top: 12rpx;
  1071. }
  1072. }
  1073. button::after {
  1074. border: none !important;
  1075. }
  1076. .share_cancel {
  1077. width: 100%;
  1078. text-align: center;
  1079. font-size: 32rpx;
  1080. font-weight: 400;
  1081. color: #333333;
  1082. line-height: 44rpx;
  1083. }
  1084. }
  1085. }
  1086. .share_content1 {
  1087. z-index: -99 !important;
  1088. }
  1089. }
  1090. </style>