index.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526
  1. <template>
  2. <page-meta :page-style="'overflow:'+(show?'hidden':'visible')"></page-meta>
  3. <view>
  4. <view class="product_image_box">
  5. <image class="product_image" :src="productInfo.thumb"></image>
  6. </view>
  7. <view class="product_info">
  8. <view class="stock_price" v-if="isShowPrice">
  9. <view class="product_price" >
  10. <text>¥{{productInfo.price}} </text>
  11. <text class="product_market">¥{{productInfo.market_price}} </text>
  12. </view>
  13. </view>
  14. <view class="product_name">{{productInfo.name}}</view>
  15. <view class="product_spec">
  16. <view class="spec_name">{{productInfo.spec}}</view>
  17. <view class="product_stock">剩{{productInfo.stock}}个</view>
  18. </view>
  19. </view>
  20. <view class="product_business" v-if="productInfo.business_info.name">
  21. <image class="logopic" :src="productInfo.business_info.logopic" ></image>
  22. <view class="business_info">
  23. <view class="business_name">
  24. {{productInfo.business_info.name}}
  25. </view>
  26. <view class="business_desc">
  27. {{productInfo.business_info.desc}}
  28. </view>
  29. </view>
  30. </view>
  31. <view class="product_description">
  32. <rich-text :nodes="productInfo.description"></rich-text>
  33. </view>
  34. <view class="product_poster" v-if="productInfo.poster" >
  35. <image class="product_image" :src="productInfo.poster" mode="widthFix"></image>
  36. </view>
  37. <view class="order_car">
  38. <navigator url="/pages/car/index" open-type="switchTab" class="to_car" >
  39. <image src="../../static/icon/car.png" class="car_icon" ></image>
  40. </navigator>
  41. <button class="show_order" data-eventsync="true" @click="showSpecPopup(1)" >立即预约</button>
  42. <button class="show_car" data-eventsync="true" @click="showSpecPopup(2)" >加入购物车</button>
  43. </view>
  44. <view class="to_bottom"> --- 到底了 --- </view>
  45. <uni-popup ref="specPopup" :show="true" type="bottom" class="popup" background-color="#FFFFFF" @change="popupChange" @maskClick="onSpecPopupClose">
  46. <view class="order_info">
  47. <view class="custom_addr" v-if="specBtnType==1" @click="showAddrPopup()">
  48. <view class="contact_user">
  49. <text class="contact_none" v-if="!checkedAddr.id">请选择收货地址</text>
  50. <text class="contact_name" >{{checkedAddr.contact_name}}</text>
  51. <text class="contact_phone" >{{checkedAddr.contact_phone}}</text>
  52. <text class="contact_more"> &gt;</text>
  53. </view>
  54. <view class="contact_addr">
  55. {{checkedAddr.contact_province}} {{checkedAddr.contact_city}} {{checkedAddr.contact_area}} {{checkedAddr.contact_addr}}
  56. </view>
  57. </view>
  58. <view class="car_item" >
  59. <view class="box_left">
  60. <image class="car_image" :src="productInfo.thumb" mode=""></image>
  61. </view>
  62. <view class="box_right">
  63. <view class="car_name">{{productInfo.name}}</view>
  64. <view class="stock_price">
  65. <view class="product_price" v-if="isShowPrice">
  66. <text>¥{{productInfo.price}} </text>
  67. <text class="car_market">¥{{productInfo.market_price}}</text>
  68. </view>
  69. <view class="product_quantity_box">
  70. <button class="product_quantity_sub" @click="changeQuantity(-1)" data-eventsync="true">
  71. <image class="sub_icon" src="../../static/icon/sub_icon.png" mode=""></image>
  72. </button>
  73. <input type="number" class="product_quantity" placeholder="数量" v-model="quantity" @blur="changeQuantity(0)" ></input>
  74. <button class="product_quantity_add" @click="changeQuantity(+1)" data-eventsync="true">
  75. <image class="add_icon" src="../../static/icon/add_icon.png" mode=""></image>
  76. </button>
  77. </view>
  78. </view>
  79. <view class="product_stock">剩{{productInfo.stock}}个</view>
  80. </view>
  81. </view>
  82. <view class="select_sku" v-if="productInfo.product_attr.length" >
  83. <scroll-view scroll-y="true" class="scroll_max" >
  84. <view class="product_attr" v-for="(spec,spec_index) in productInfo.product_attr" :key="spec_index">
  85. <scroll-view scroll-y="true" class="scroll_y" >
  86. <view class="spec_name">{{ spec.spec_name }}</view>
  87. <view class="arrt_list">
  88. <view class="arrt_option" :class="option.active?'active':''" v-for="(option,attr_index) in spec.attr_list" :key="attr_index" @click="attrChange(spec_index,attr_index)">
  89. {{option.name}}
  90. </view>
  91. </view>
  92. </scroll-view>
  93. </view>
  94. </scroll-view>
  95. </view>
  96. <!-- 选择优惠券 -->
  97. <view class="to_select_coupon" v-if="specBtnType==1" @click="openCoupon()">
  98. <text>优惠券</text>
  99. <view class="coupon_deduction">{{couponUsed}}</view>
  100. </view>
  101. <view class="order_price" v-if="specBtnType==1" >合计: ¥{{priceTotal}}</view>
  102. <view class="order_btn">
  103. <button class="to_order" @click="createOrder()" v-if="specBtnType==1" data-eventsync="true" >预约</button>
  104. <button class="to_car" @click="createCart()" v-if="specBtnType==2" data-eventsync="true" >加入购物车</button>
  105. </view>
  106. </view>
  107. </uni-popup>
  108. <uni-popup ref="couponPopup" type="bottom" class="popup" background-color="#FFFFFF" >
  109. <view class="popup_title">优惠券</view>
  110. <view class="coupon_list">
  111. <view class="coupon_item" v-for="(item,index) in couponList" @click="checkedCoupon(index)" :key="index">
  112. <view class="box_left">
  113. <view class="rebate" v-if="item.rebate_type == 1" > ¥{{item.rebate}}</view>
  114. <view class="rebate" v-if="item.rebate_type == 2" > 打 {{item.rebate}} 折</view>
  115. <view class="rebate" v-if="item.rebate_type == 3" > 赠 <text v-if="item.rebate_scope.length">
  116. {{item.rebate_scope[0].product_name}}
  117. </text> </view>
  118. <view class="std_pay"> 满{{item.std_pay}}</view>
  119. </view>
  120. <view class="box_right">
  121. <view class="coupon_title">
  122. <view class="coupon_name" v-if="item.rebate_type == 1">满减券</view>
  123. <view class="coupon_name" v-if="item.rebate_type == 2">折扣券</view>
  124. <view class="coupon_name" v-if="item.rebate_type == 3">赠品券</view>
  125. </view>
  126. <view class="product_scope">
  127. <text class="" v-if="item.type_id == 1">限定商品可用</text>
  128. <text class="" v-if="item.type_id == 2">全场可用</text>
  129. <view class="check_label" >
  130. <view class="isstd" v-if="!item.is_std">不可用</view>
  131. <image class="checkbox" v-if="item.is_std" :src="item.checked?'../../static/icon/checked.png':'../../static/icon/checkbox.png'"></image>
  132. </view>
  133. </view>
  134. <view class="coupon_info">
  135. <view class="coupon_exp">{{item.exp_time}} 到期</view>
  136. </view>
  137. </view>
  138. </view>
  139. </view>
  140. </uni-popup>
  141. <uni-popup ref="addrPopup" type="bottom" class="popup" background-color="#FFFFFF" >
  142. <view class="popup_title">收货地址 <navigator url="/pages/addr/index?notify=addr" class="to_addr_page">管理</navigator> </view>
  143. <view class="addr_list">
  144. <view class="addr_item" v-for="(item,index) in addrList" :key="index" @click="checkedAddrItem(item)">
  145. <view class="radio_label">
  146. <image class="radio_icon" :src="item.id == checkedAddr.id? '../../static/icon/radioed.png' : '../../static/icon/radio.png'" ></image>
  147. </view>
  148. <view class="contact_user">
  149. <text class="contact_name">{{item.contact_name}}</text>
  150. <text class="contact_phone">{{item.contact_phone}}</text>
  151. <text class="contact_default" v-if="item.is_default">默认</text>
  152. </view>
  153. <view class="contact_addr">
  154. {{item.contact_province}} {{item.contact_city}} {{item.contact_area}} {{item.contact_addr}}
  155. </view>
  156. </view>
  157. </view>
  158. <view class="create_box">
  159. <navigator url="/pages/addr/index?notify=addr&type=create" class="create_addr" >新建收货地址</navigator>
  160. </view>
  161. </uni-popup>
  162. <uni-popup ref="addFollow" type="center" class="center_popup" @change="popupChange">
  163. <view class="add_follow">
  164. <view class="close_area"><button class="close_btn" @click="closeAddFollow()">关闭</button></view>
  165. <view class="info_alter">长按识别二维码添加客服</view>
  166. <view class="qr_code_area">
  167. <image v-if="followQrcode" :src="followQrcode" class="qr_code" mode="" show-menu-by-longpress></image>
  168. </view>
  169. <button class="save_btn" @click="saveImage()">保存图片添加客服</button>
  170. <view class="rule_info">
  171. <view class="">报单规则:</view>
  172. <view class="">1、预约报单需要添加客服人员</view>
  173. <view class="">2、添加完客服人员后返回小程序填写商家资质</view>
  174. <view class="">3、开始预约报单</view>
  175. </view>
  176. </view>
  177. </uni-popup>
  178. </view>
  179. </template>
  180. <script>
  181. export default {
  182. data() {
  183. return {
  184. show:false, // 使用Popup组件时,阻止禁止滚动穿透
  185. productInfo:{
  186. id:0,
  187. name:"",
  188. price:"0.00",
  189. market_price:"0.00",
  190. spec:"",
  191. stock:0,
  192. thumb:"",
  193. poster:"",
  194. description:"",
  195. business_info:{
  196. name:"",
  197. logopic:"",
  198. desc:"",
  199. },
  200. product_attr:[],
  201. product_sku:[],
  202. },
  203. requestParam:{
  204. id:0,
  205. },
  206. // 数量
  207. quantity:1,
  208. // 总价
  209. priceTotal:"0.00",
  210. // 优惠券列表
  211. couponList:[],
  212. // 总价
  213. priceTotal:'0.00',
  214. // 优惠券使用
  215. couponUsed:"去使用 >",
  216. // 扣减金额
  217. rebatePrice:0.00,
  218. // 已经选择的优惠券ID
  219. customCoupon: 0,
  220. // 规格选择按钮类型
  221. specBtnType: 1, // 1预约。2购物车
  222. // 地址列表
  223. addrList:[],
  224. // 已选地址
  225. checkedAddr:{
  226. id:0,
  227. contact_name:"",
  228. contact_phone:"",
  229. contact_province:"",
  230. contact_city:"",
  231. contact_area:"",
  232. contact_addr:"",
  233. is_default:0,
  234. },
  235. // 客服二维码
  236. followQrcode:"",
  237. // 是否登录状态
  238. isShowPrice:false,
  239. // 选择的skuid
  240. sku_id:0,
  241. //是否选择所有规格
  242. hasValidSpecSelected: false,
  243. }
  244. },
  245. onLoad(param) {
  246. // 接受路由参数,产品ID
  247. this.requestParam.id = param.product_id;
  248. var that = this;
  249. // 监听地址变动
  250. uni.$on('addr_list_change',function(data){
  251. // 地址列表
  252. that.addrList = data.list;
  253. });
  254. // #ifdef MP-WEIXIN
  255. //分享按钮
  256. uni.showShareMenu({
  257. withShareTicket: true,
  258. menus: ['shareAppMessage', 'shareTimeline']
  259. })
  260. // #endif
  261. },
  262. onShareAppMessage(obj) {
  263. return {
  264. title: '双十一 药优惠 得积分 兑豪礼',
  265. path: '/pages/index/index'
  266. }
  267. },
  268. onShow() {
  269. // 没有添加客服就不显示
  270. this.isShowPrice = this.$checkAccess.checkShowPrice();
  271. // 如果存在产品ID的话
  272. if( this.requestParam.id > 0) {
  273. // 请求详情
  274. this.$http.request('api/product/get_detail',this.requestParam).then((re)=>{
  275. // 成功渲染数据
  276. if( re.code == 'success' ) {
  277. // 刷新数据
  278. this.productInfo = re.data;
  279. //设置默认sku
  280. // this.setDefaultSpec();
  281. }
  282. });
  283. };
  284. },
  285. methods: {
  286. // 地址弹出层
  287. showAddrPopup(){
  288. // 显示下单弹出层
  289. this.$refs.addrPopup.open('bottom');
  290. },
  291. // 规格弹出层
  292. showSpecPopup(type){
  293. // 登录提示
  294. if( !this.$checkAccess.alterLogin()) return ;
  295. // 判断是否弹出
  296. // if( this.$checkAccess.getFollowQrcode() ) return this.openAddFollow();
  297. // 显示类型,1预约,2购物车
  298. this.specBtnType = type;
  299. // 恢复优惠券使用按钮
  300. this.couponUsed = "去使用 >";
  301. // 恢复扣减金额
  302. this.rebatePrice = 0.00;
  303. // 选择优惠券重置
  304. this.customCoupon = 0;
  305. // 计算价格
  306. this.priceHandler();
  307. // 显示下单弹出层
  308. this.$refs.specPopup.open('bottom');
  309. // 结果
  310. this.$http.request('api/custom_coupon/get_checked',this.requestParam).then((re)=>{
  311. if( re.code == 'success' ){
  312. // 赋值
  313. this.couponList = re.data;
  314. // 优惠券是否可用
  315. this.checkCoupon();
  316. }
  317. });
  318. // 地址列表
  319. this.getAddrList();
  320. //只有一组sku时是否下架
  321. if(this.productInfo.product_sku.length === 1){
  322. this.defaultSkuStatus();
  323. }
  324. //如果当前商品没有规格,可以直接加入购物车
  325. if(this.productInfo.product_attr.length === 0){
  326. this.hasValidSpecSelected = true;
  327. }
  328. },
  329. // 优惠券弹出层
  330. openCoupon(){
  331. this.$refs.couponPopup.open('bottom')
  332. },
  333. // 数量调整
  334. changeQuantity(number){
  335. // 如果不是0.表示两侧按钮点击,0表示输入的修改
  336. if( number != 0 ) {
  337. // 计算个数
  338. this.quantity = this.quantity + number;
  339. }
  340. // 如果大于库存设置为库存
  341. if( this.quantity > this.productInfo.stock ) {
  342. this.quantity = this.productInfo.stock;
  343. uni.showToast({
  344. title:"库存不足",
  345. icon:"none"
  346. })
  347. }
  348. // 如果小于1.设置为1
  349. if( this.quantity < 1 ) {
  350. this.quantity = 1;
  351. uni.showToast({title:"数量不可以小于0",icon:"none"})
  352. }
  353. // 计算价格
  354. this.priceHandler();
  355. // 优惠券是否可用
  356. this.checkCoupon();
  357. },
  358. // 创建订单
  359. createOrder(){
  360. // 不可预约
  361. if( !this.$checkAccess.alertCity() ) return;
  362. // 下单数量小于0
  363. if( this.quantity < 1 ) {
  364. uni.showToast({
  365. title:"至少购买1个"
  366. })
  367. return;
  368. }
  369. // 如果大于库存设置为库存
  370. if( this.productInfo.stock < 1 ) {
  371. uni.showToast({
  372. title:"库存不足",
  373. icon:"none"
  374. })
  375. return;
  376. }
  377. // 如果大于库存设置为库存
  378. if( this.productInfo.stock < this.quantity ) {
  379. this.quantity = this.productInfo.stock;
  380. uni.showToast({
  381. title:"库存不足",
  382. icon:"none"
  383. })
  384. return;
  385. }
  386. // 地址未填
  387. if( !this.checkedAddr.id ) {
  388. uni.showToast({
  389. title:"请选择收货地址",
  390. icon:"none"
  391. })
  392. return;
  393. }
  394. //规格没有选中全
  395. if(!this.hasValidSpecSelected){
  396. uni.showToast({
  397. title:"请选择所有规格",
  398. icon:"none"
  399. })
  400. return;
  401. }
  402. //需要下单的产品信息参数传给completion页面
  403. let productInfo = [{name:this.productInfo.name,spec:this.productInfo.spec,price:this.productInfo.price}]
  404. //转成json字符串
  405. productInfo = JSON.stringify(productInfo);
  406. //加密json格式成编码数组
  407. let encodedArray = encodeURIComponent(productInfo);
  408. // 需要下单的产品列表
  409. let productList = [{product_id:this.productInfo.id,buy_num:this.quantity,product_skuid:this.sku_id}];
  410. // 转成json字符串传输
  411. productList = JSON.stringify(productList);
  412. // 请求接口
  413. this.$http.request('api/orders/create',{"product_list":productList,"custom_coupon_id":this.customCoupon,'addr_id':this.checkedAddr.id},'post').then((re)=>{
  414. // 判断结果
  415. if( re.code == 'success' ) {
  416. // 处理结果
  417. this.productInfo.stock = this.productInfo.stock - this.quantity;
  418. // 关闭弹窗
  419. this.$refs.specPopup.close();
  420. // 跳转到报单完成页面
  421. uni.navigateTo({url:`/pages/orders/completion?params=${encodedArray}`});
  422. }else{
  423. uni.showModal({title:re.msg,showCancel:false});
  424. }
  425. });
  426. },
  427. // 加入购物车
  428. createCart(){
  429. // 不可预约
  430. if( !this.$checkAccess.alertCity() ) return;
  431. // 下单数量小于0
  432. if( this.quantity < 1 ) {
  433. uni.showToast({
  434. title:"至少购买1个"
  435. })
  436. return;
  437. }
  438. // 如果库存不足
  439. if( this.productInfo.stock < 1 ) {
  440. uni.showToast({
  441. title:"库存不足",
  442. icon:"none"
  443. })
  444. return;
  445. }
  446. // 如果大于库存设置为库存
  447. if( this.productInfo.stock < this.quantity ) {
  448. this.quantity = this.productInfo.stock;
  449. uni.showToast({
  450. title:"库存不足",
  451. icon:"none"
  452. })
  453. return;
  454. }
  455. //规格没有选中全
  456. if(!this.hasValidSpecSelected){
  457. uni.showToast({
  458. title:"请选择所有规格",
  459. icon:"none"
  460. })
  461. return;
  462. }
  463. // 商品信息
  464. let data = {product_id:this.productInfo.id,buy_num:this.quantity,skuid:this.sku_id};
  465. // 请求接口
  466. this.$http.request('api/shop_cart/add',data,'post').then((re)=>{
  467. // 判断结果
  468. if( re.code == 'success' ) {
  469. // 跳转到订单列表
  470. uni.showToast({
  471. icon:"success",
  472. title:"加入购物车成功"
  473. })
  474. // 关闭结果
  475. this.$refs.specPopup.close();
  476. }else{
  477. // 跳转到订单列表
  478. uni.showToast({
  479. icon:"error",
  480. title:"加入购物车失败"
  481. })
  482. }
  483. });
  484. },
  485. // 检查优惠券是否可用
  486. checkCoupon(){
  487. // 如果存在的话
  488. if( this.couponList.length ){
  489. let hasIsStd = false;
  490. // 循环优惠券
  491. for (let i in this.couponList) {
  492. /* 商品的总价格,决定是否可用 */
  493. let totalPrice = 0.00;
  494. // 如果是商品券
  495. if( this.couponList[i].type_id == 1 ){
  496. // 判断商品是不是在商品范围
  497. let isScope = false;
  498. // 循环商品范围
  499. for (let k in this.couponList[i].product_scope) {
  500. // 如果存在商品范围
  501. if( this.couponList[i].product_scope[k].product_id == this.productInfo.id) isScope = true;
  502. }
  503. // 范围内的做计算
  504. if( isScope ) totalPrice = this.$decimal.add(totalPrice,this.$decimal.mul(this.productInfo.price,this.quantity));
  505. // 店铺券
  506. }else{
  507. // 店铺券
  508. totalPrice = this.$decimal.add(totalPrice,this.$decimal.mul(this.productInfo.price,this.quantity));
  509. }
  510. // 判断价格到不到限额
  511. this.couponList[i].is_std = parseFloat(totalPrice.toFixed()) >= parseFloat(this.$decimal.mul(this.couponList[i].std_pay,1).toFixed());
  512. // 如果不可用的话,该项已选择则不选
  513. if( !this.couponList[i].is_std && this.couponList[i].checked ) this.checkedCoupon(i);
  514. }
  515. }
  516. },
  517. // 选择优惠券
  518. checkedCoupon(index){
  519. // 单个设置选中/未选
  520. this.couponList[index].checked = this.couponList[index].checked ? 0 : 1;
  521. // 循环处理
  522. for (let i in this.couponList) {
  523. // 有未选的就不做全选
  524. if( index != i ) this.couponList[i].checked = 0;
  525. }
  526. // 如果未选中,提示可用
  527. if( !this.couponList[index].checked ) this.couponUsed = '去使用 >';
  528. // 已经选择的优惠券ID
  529. this.customCoupon = this.couponList[index].checked ? this.couponList[index].id : 0;
  530. // 计算扣减
  531. this.couponRebate();
  532. // 计算价格
  533. this.priceHandler();
  534. // 关闭弹窗
  535. this.$refs.couponPopup.close();
  536. },
  537. // 计算价格
  538. priceHandler(){
  539. // 总价格
  540. let priceTotal = this.$decimal.mul(this.productInfo.price,this.quantity);
  541. // 扣减数据
  542. priceTotal = priceTotal.sub(this.rebatePrice);
  543. // 小数点保留
  544. this.priceTotal = priceTotal.toFixed(2);
  545. },
  546. // 计算优惠券扣减
  547. couponRebate(){
  548. // 默认扣减0
  549. this.rebatePrice = 0;
  550. // 循环优惠券
  551. for (let i in this.couponList) {
  552. // 判断是否选中
  553. if( this.couponList[i].id != this.customCoupon ){
  554. // 未选择的不管
  555. continue;
  556. }
  557. /* 商品的总价格,决定是否可用 */
  558. var totalPrice = 0.00;
  559. // 如果是商品券
  560. if( this.couponList[i].type_id == 1 ){
  561. // 判断商品是不是在商品范围
  562. var isScope = false;
  563. // 循环商品范围
  564. for (let k in this.couponList[i].product_scope) {
  565. // 如果存在商品范围
  566. if( this.couponList[i].product_scope[k].product_id == this.productInfo.id) isScope = true;
  567. }
  568. // 范围内的做计算
  569. if( isScope ) totalPrice = this.$decimal.mul(this.productInfo.price,this.quantity);
  570. }else{
  571. // 折扣券以及满减券的话,计算价格
  572. totalPrice = this.$decimal.mul(this.productInfo.price,this.quantity);
  573. }
  574. // 如果是可以用的话
  575. if( parseFloat(totalPrice.toFixed()) >= parseFloat(this.$decimal.mul(this.couponList[i].std_pay,1).toFixed()) ){
  576. // 扣减金额
  577. let rebatePrice = this.$decimal.mul(1,0);
  578. // 满减
  579. if( this.couponList[i].rebate_type == 1 ){
  580. // 计算扣减数据
  581. rebatePrice = this.$decimal.mul(this.couponList[i].rebate,1);
  582. // 替换文字
  583. this.couponUsed = "¥-" + rebatePrice.toFixed(2);
  584. }
  585. // 折扣
  586. if( this.couponList[i].rebate_type == 2 ){
  587. // 折扣
  588. rebatePrice = this.$decimal.mul(totalPrice,this.couponList[i].rebate);
  589. // 减数
  590. rebatePrice = this.$decimal.sub(totalPrice,rebatePrice.mul(0.1));
  591. // 替换文字
  592. this.couponUsed = "¥-" + rebatePrice.toFixed(2);
  593. }
  594. // 赠品
  595. if( this.couponList[i].rebate_type == 3 ){
  596. // 替换文字
  597. this.couponUsed = "送" + ( this.couponList[i].rebate_scope.length ? this.couponList[i].rebate_scope[0].product_name: "");
  598. }
  599. // 小数点保留
  600. this.rebatePrice = rebatePrice.toFixed(2);
  601. }
  602. }
  603. },
  604. popupChange(e){
  605. // 禁止滚动穿透
  606. this.show = e.show
  607. },
  608. // 选择地址
  609. checkedAddrItem(item){
  610. this.checkedAddr = item;
  611. this.$refs.addrPopup.close();
  612. },
  613. getAddrList(){
  614. // 判断数据
  615. this.$http.request('api/custom_addr/get_list').then((callback)=>{
  616. // 获取成功
  617. if( callback.code == 'success' ){
  618. this.addrList = callback.data;
  619. // 如果有的话
  620. if( this.addrList.length ){
  621. // 获取默认的
  622. for (let i in this.addrList) {
  623. // 如果是默认的
  624. if( this.addrList[i].is_default ) this.checkedAddr = this.addrList[i];
  625. }
  626. // 如果没有默认的话
  627. if( !this.checkedAddr.id ){
  628. this.checkedAddr = this.addrList[this.addrList.length-1];
  629. }
  630. }
  631. }
  632. });
  633. },
  634. // 客服显示
  635. openAddFollow(){
  636. // 返回结果
  637. this.followQrcode = this.$checkAccess.getFollowQrcode();
  638. // 有图才展示
  639. if( this.followQrcode ) this.$refs.addFollow.open('center');
  640. },
  641. closeAddFollow(){
  642. this.$refs.addFollow.close();
  643. },
  644. // 保存图片
  645. saveImage(){
  646. var that = this;
  647. // 下载远程图片后保存到相册
  648. uni.downloadFile({
  649. url: this.followQrcode,
  650. success:function(res) {
  651. if(res.statusCode == 200){
  652. uni.saveImageToPhotosAlbum({
  653. filePath: res.tempFilePath,
  654. success:function(res) {
  655. uni.showToast({title:"保存成功",icon:'none'});
  656. that.$refs.addFollow.close();
  657. },
  658. fail:function(err){
  659. }
  660. });
  661. }
  662. },
  663. })
  664. },
  665. // 设置默认sku
  666. // setDefaultSpec(){
  667. // // 如果列表存在
  668. // if( this.productInfo.product_sku.length ){
  669. // //如果列表大于1
  670. // if(this.productInfo.product_sku.length > 1){
  671. // //循环sku列表
  672. // for(var k = 0 ; k < this.productInfo.product_sku.length;k++ ){
  673. // //全部规格都已经下架
  674. // if(k === this.productInfo.product_sku.length){
  675. // uni.showToast({
  676. // title:"当前商品已全部下架",
  677. // icon:"error"
  678. // })
  679. // this.productInfo.stock = 0;
  680. // return;
  681. // }
  682. // // 获取第一个没有下架的sku作为默认值
  683. // if(this.productInfo.product_sku[k].status === 0){
  684. // var attr_ids = this.productInfo.product_sku[k].attr_ids.split(",");
  685. // break;
  686. // }
  687. // }
  688. // // 循环规格列表
  689. // for ( let i in this.productInfo.product_attr ) {
  690. // // 再循环属性
  691. // for (let j in this.productInfo.product_attr[i].attr_list) {
  692. // // 如果不等于id
  693. // if( attr_ids.includes(this.productInfo.product_attr[i].attr_list[j].id + '') ){
  694. // // 设置选中
  695. // this.productInfo.product_attr[i].attr_list[j].active = 1;
  696. // }else{
  697. // this.productInfo.product_attr[i].attr_list[j].active = 0;
  698. // }
  699. // }
  700. // }
  701. // // 产品价格修改
  702. // this.productInfo.price = this.productInfo.product_sku[k].price;
  703. // // 产品规格修改
  704. // // this.productInfo.spec = this.productInfo.product_sku[k].attr_names;
  705. // // 产品库存
  706. // this.productInfo.stock = this.productInfo.product_sku[k].stock;
  707. // // 产品SKU
  708. // this.sku_id = this.productInfo.product_sku[k].id;
  709. // // 计算价格
  710. // this.priceHandler();
  711. // // 优惠券是否可用
  712. // this.checkCoupon();
  713. // }else{
  714. // var attr_ids = this.productInfo.product_sku[0].attr_ids.split(",");
  715. // // 循环规格列表
  716. // for ( let i in this.productInfo.product_attr ) {
  717. // // 再循环属性
  718. // for (let j in this.productInfo.product_attr[i].attr_list) {
  719. // // 如果不等于id
  720. // if( attr_ids.includes(this.productInfo.product_attr[i].attr_list[j].id + '') ){
  721. // // 设置选中
  722. // this.productInfo.product_attr[i].attr_list[j].active = 1;
  723. // }else{
  724. // this.productInfo.product_attr[i].attr_list[j].active = 0;
  725. // }
  726. // }
  727. // }
  728. // // 产品价格修改
  729. // this.productInfo.price = this.productInfo.product_sku[0].price;
  730. // // 产品规格修改
  731. // this.productInfo.spec = this.productInfo.product_sku[0].attr_names;
  732. // // 产品库存
  733. // this.productInfo.stock = this.productInfo.product_sku[0].stock;
  734. // // 产品SKU
  735. // this.sku_id = this.productInfo.product_sku[0].id;
  736. // // 计算价格
  737. // this.priceHandler();
  738. // // 优惠券是否可用
  739. // this.checkCoupon();
  740. // }
  741. // }
  742. // },
  743. // 属性变更
  744. attrChange(spec_index,attr_index){
  745. // 判断当前属性是否选择。选择的跳过
  746. if (this.productInfo.product_attr[spec_index].attr_list[attr_index].active) return;
  747. // 先记录当前规格下所有属性原来的active状态
  748. let originalActiveStates = {};
  749. for (let i in this.productInfo.product_attr[spec_index].attr_list) {
  750. originalActiveStates[i] = this.productInfo.product_attr[spec_index].attr_list[i].active;
  751. }
  752. //循环规格下的属性
  753. for ( let i in this.productInfo.product_attr[spec_index].attr_list ) {
  754. // 全部改为未选中
  755. this.productInfo.product_attr[spec_index].attr_list[i].active = 0;
  756. }
  757. //选择选项
  758. this.productInfo.product_attr[spec_index].attr_list[attr_index].active = 1;
  759. //选中的规格
  760. var attr_ids = [];
  761. // 循环规格
  762. for ( let i in this.productInfo.product_attr ) {
  763. // 再循环属性
  764. // for (let j in this.productInfo.product_attr[i].attr_list) {
  765. // // 如果选中的
  766. // if( this.productInfo.product_attr[i].attr_list[j].active ){
  767. // this.attr_ids.push(this.productInfo.product_attr[i].attr_list[j].id);
  768. // }
  769. // }
  770. for (let j in this.productInfo.product_attr[i].attr_list) {
  771. if (this.productInfo.product_attr[i].attr_list[j].active) {
  772. if (this.productInfo.product_attr[i].spec_id === 1) {
  773. attr_ids.push({ spec_id: 1, id: this.productInfo.product_attr[i].attr_list[j].id });
  774. } else if (this.productInfo.product_attr[i].spec_id === 2) {
  775. attr_ids.push({ spec_id: 2, id: this.productInfo.product_attr[i].attr_list[j].id });
  776. }
  777. }
  778. }
  779. }
  780. // 转成字符串
  781. // var attrids = this.attr_ids.join(",");
  782. // 转成字符串
  783. let colorAttridsStr = attr_ids.filter((item) => item.spec_id === 1).map((item) => item.id).join(",");
  784. let sizeAttridsStr = attr_ids.filter((item) => item.spec_id === 2).map((item) => item.id).join(",");
  785. let isSelectionComplete = 0;
  786. // 判断是否两个规格下的属性都已选中
  787. if (colorAttridsStr && colorAttridsStr.length > 0 && sizeAttridsStr && sizeAttridsStr.length > 0) {
  788. this.hasValidSpecSelected = true;
  789. isSelectionComplete = 1;
  790. } else {
  791. this.hasValidSpecSelected = false;
  792. isSelectionComplete = 0;
  793. }
  794. // 如果当前点击的属性对应的SKU状态为未下架(初始化为0)
  795. let currentSKUStatus = 0;
  796. // 匹配规格
  797. if( this.productInfo.product_sku.length ){
  798. // 是否有对应的SKU
  799. let haveSku = false;
  800. // 先检查colorAttridsStr和sizeAttridsStr是否都已正确生成
  801. if (colorAttridsStr && colorAttridsStr.length > 0 && sizeAttridsStr && sizeAttridsStr.length > 0) {
  802. // 循环sku
  803. for (let i in this.productInfo.product_sku) {
  804. // 如果sku不匹配
  805. if( this.productInfo.product_sku[i].attr_ids != colorAttridsStr + "," + sizeAttridsStr ) continue;
  806. // 设置有SKU
  807. haveSku = 1;
  808. // 获取当前匹配到的SKU的状态
  809. currentSKUStatus = this.productInfo.product_sku[i].status;
  810. // 如果商品已经下架(status等于1),则恢复当前规格下所有属性原来的active状态
  811. if(currentSKUStatus === 1){
  812. uni.showToast({title:"该规格已下架",icon:"none"});
  813. for (let k in originalActiveStates) {
  814. this.productInfo.product_attr[spec_index].attr_list[k].active = originalActiveStates[k];
  815. }
  816. continue;
  817. }
  818. // 如果商品没有库存
  819. if( this.productInfo.product_sku[i].stock <= 0 ){
  820. uni.showToast({title:"该规格库存不足",icon:"none"});
  821. for (let k in originalActiveStates) {
  822. this.productInfo.product_attr[spec_index].attr_list[k].active = originalActiveStates[k];
  823. }
  824. continue;
  825. }
  826. // console.log("我怎么没有执行?");
  827. // 产品价格修改
  828. this.productInfo.price = this.productInfo.product_sku[i].price;
  829. // 产品规格修改
  830. this.productInfo.spec = this.productInfo.product_sku[i].attr_names;
  831. // 产品库存
  832. this.productInfo.stock = this.productInfo.product_sku[i].stock;
  833. // 产品SKU
  834. this.sku_id = this.productInfo.product_sku[i].id;
  835. // 计算价格
  836. this.priceHandler();
  837. // 优惠券是否可用
  838. this.checkCoupon();
  839. }
  840. }
  841. // 如果没有对应的SKU
  842. if( !haveSku && isSelectionComplete ){
  843. uni.showToast({title:"该规格已下架",icon:"none"});
  844. for (let k in originalActiveStates) {
  845. this.productInfo.product_attr[spec_index].attr_list[k].active = originalActiveStates[k];
  846. }
  847. }
  848. }
  849. },
  850. //specPopup关闭时重置数据
  851. onSpecPopupClose(){
  852. let colorSpecAttrList = this.productInfo.product_attr.find((spec) => spec.spec_id === 1).attr_list;
  853. let sizeSpecAttrList = this.productInfo.product_attr.find((spec) => spec.spec_id === 2).attr_list;
  854. //重置上一次规格全部选中
  855. this.hasValidSpecSelected = false;
  856. // 恢复颜色分类规格下属性的原始active状态
  857. for (let i in colorSpecAttrList) {
  858. colorSpecAttrList[i].active = 0;
  859. }
  860. // 恢复尺寸规格下属性的原始active状态
  861. for (let i in sizeSpecAttrList) {
  862. sizeSpecAttrList[i].active = 0;
  863. }
  864. this.$refs.specPopup.close()
  865. },
  866. //只有一组sku默认规格是否已下架
  867. defaultSkuStatus(){
  868. if(this.productInfo.product_sku.length){
  869. if(this.productInfo.product_sku[0].status === 1){
  870. uni.showToast({
  871. title:"该规格已下架",
  872. icon:"none",
  873. });
  874. this.productInfo.stock = 0;
  875. var attr_ids = this.productInfo.product_sku[0].attr_ids.split(",");
  876. // 循环规格列表
  877. for ( let i in this.productInfo.product_attr ) {
  878. // 再循环属性
  879. for (let j in this.productInfo.product_attr[i].attr_list) {
  880. // 如果不等于id
  881. if( attr_ids.includes(this.productInfo.product_attr[i].attr_list[j].id + '') ){
  882. // 取消选中
  883. this.productInfo.product_attr[i].attr_list[j].active = 0;
  884. }
  885. }
  886. }
  887. return;
  888. }
  889. }
  890. }
  891. }
  892. }
  893. </script>
  894. <style lang="less">
  895. .product_image_box{
  896. display: block;
  897. overflow: hidden;
  898. background: #FFFFFF;
  899. margin: 10rpx auto;
  900. .product_image{
  901. display: block;
  902. margin: 0 auto;
  903. width: 750rpx;
  904. height: 750rpx;
  905. }
  906. }
  907. .product_info{
  908. display: block;
  909. background: #FFFFFF;
  910. margin: 10rpx 0rpx;
  911. padding: 10px 10px;
  912. .product_name{
  913. max-height: 80rpx;
  914. font-size: 30rpx;
  915. line-height: 40rpx;
  916. overflow: hidden;
  917. padding: 10rpx 0rpx;
  918. }
  919. .product_spec{
  920. color: #999999;
  921. font-size: 24rpx;
  922. line-height: 30rpx;
  923. overflow: hidden;
  924. .spec_name{
  925. float: left;
  926. }
  927. .product_stock{
  928. float: right;
  929. }
  930. }
  931. .stock_price{
  932. font-size: 20rpx;
  933. overflow: hidden;
  934. margin-top: 10rpx;
  935. line-height: 30rpx;
  936. .product_price{
  937. float: left;
  938. color: red;
  939. font-size: 38rpx;
  940. line-height: 60rpx;
  941. .product_market{
  942. font-size: 24rpx;
  943. color: #999999;
  944. line-height: 30rpx;
  945. margin-left: 10rpx;
  946. text-decoration: line-through;
  947. }
  948. }
  949. }
  950. }
  951. // 描述简介
  952. .product_business{
  953. display: block;
  954. overflow: hidden;
  955. padding: 20rpx 20rpx;
  956. margin: 10rpx auto;
  957. background: #FFFFFF;
  958. .logopic{
  959. float: left;
  960. width: 80rpx;
  961. height: 80rpx;
  962. border-radius: 50%;
  963. margin-right: 20rpx;
  964. }
  965. .business_info{
  966. float: left;
  967. width: 600rpx;
  968. overflow: hidden;
  969. .business_name{
  970. font-size: 26rpx;
  971. line-height: 40rpx;
  972. }
  973. .business_desc{
  974. color: #999999;
  975. font-size: 24rpx;
  976. line-height: 40rpx;
  977. }
  978. }
  979. }
  980. .product_description{
  981. width: 700rpx;
  982. display: block;
  983. overflow: hidden;
  984. background: #FFFFFF;
  985. min-height: 600rpx;
  986. font-size: 26rpx;
  987. margin: 0rpx auto;
  988. line-height: 50rpx;
  989. padding: 10rpx 25rpx;
  990. [alt]{ //web_view图片
  991. max-width: 100%; // 避免图片超宽
  992. vertical-align: bottom; // 避免图片之间间隙
  993. }
  994. }
  995. .product_poster{
  996. display: block;
  997. overflow: hidden;
  998. padding: 10rpx 0rpx;
  999. margin: 10rpx auto;
  1000. background: #FFFFFF;
  1001. .product_image{
  1002. width: 750rpx;
  1003. display: block;
  1004. }
  1005. }
  1006. .order_car{
  1007. left: 0rpx;
  1008. width: 750rpx;
  1009. height: 140rpx;
  1010. display: block;
  1011. position: fixed;
  1012. padding-top: 20rpx;
  1013. background: #FFFFFF;
  1014. bottom: var(--window-bottom);
  1015. border-top: 2rpx solid #DDDDDD;
  1016. .show_order{
  1017. float: right;
  1018. width: 280rpx;
  1019. height: 80rpx;
  1020. display: block;
  1021. color: #FFFFFF;
  1022. font-size: 30rpx;
  1023. overflow: hidden;
  1024. line-height: 80rpx;
  1025. padding: 0rpx 0rpx;
  1026. text-align: center;
  1027. margin-right: 35rpx;
  1028. background-color: #E03519;
  1029. border-radius: 0rpx;
  1030. border-top-right-radius: 20rpx;
  1031. border-bottom-right-radius: 20rpx;
  1032. }
  1033. .show_car{
  1034. float: right;
  1035. width: 280rpx;
  1036. height: 80rpx;
  1037. display: block;
  1038. color: #FFFFFF;
  1039. font-size: 30rpx;
  1040. overflow: hidden;
  1041. line-height: 80rpx;
  1042. padding: 0rpx 0rpx;
  1043. text-align: center;
  1044. background-color: #F59A23;
  1045. border-radius: 0rpx;
  1046. border-top-left-radius: 20rpx;
  1047. border-bottom-left-radius: 20rpx;
  1048. }
  1049. .to_car{
  1050. float: left;
  1051. width: 100rpx;
  1052. height: 60rpx;
  1053. display: block;
  1054. text-align: center;
  1055. margin-left: 35rpx;
  1056. padding-top: 10rpx;
  1057. .car_icon{
  1058. float: left;
  1059. width: 60rpx;
  1060. height: 60rpx;
  1061. display: block;
  1062. }
  1063. }
  1064. }
  1065. .popup{
  1066. overflow: hidden;
  1067. .popup_title{
  1068. display: block;
  1069. overflow: hidden;
  1070. margin: 0rpx auto;
  1071. font-size: 36rpx;
  1072. height: 120rpx;
  1073. line-height: 120rpx;
  1074. padding: 0rpx 20rpx;
  1075. border-bottom: 10rpx solid #F8F8F8;
  1076. .to_addr_page{
  1077. float: right;
  1078. color: #F59A23;
  1079. display: block;
  1080. height: 120rpx;
  1081. line-height: 120rpx;
  1082. font-size: 26rpx;
  1083. padding: 0rpx 10rpx;
  1084. }
  1085. }
  1086. .order_info{
  1087. overflow: hidden;
  1088. background: #FFFFFF;
  1089. .custom_addr{
  1090. width: 680rpx;
  1091. display: block;
  1092. font-size: 24rpx;
  1093. overflow: hidden;
  1094. margin: 0rpx auto;
  1095. line-height: 40rpx;
  1096. padding: 20rpx 35rpx;
  1097. background-color: #FFFFFF;
  1098. border-bottom: 2rpx solid #dddddd;
  1099. .contact_user{
  1100. display: block;
  1101. font-size: 24rpx;
  1102. line-height: 50rpx;
  1103. .contact_none{
  1104. font-size: 26rpx;
  1105. font-weight: bold;
  1106. }
  1107. .contact_name{
  1108. font-size: 26rpx;
  1109. font-weight: bold;
  1110. margin-right: 16rpx;
  1111. }
  1112. .contact_more{
  1113. float: right;
  1114. font-size: 40rpx;
  1115. font-weight: bold;
  1116. }
  1117. }
  1118. .contact_addr{
  1119. width: 620rpx;
  1120. display: block;
  1121. font-size: 24rpx;
  1122. line-height: 30rpx;
  1123. padding: 10rpx 5rpx;
  1124. }
  1125. }
  1126. .car_item{
  1127. height: 200rpx;
  1128. display: block;
  1129. background: #FFFFFF;
  1130. margin: 20rpx auto;
  1131. .box_left{
  1132. float: left;
  1133. width: 160rpx;
  1134. height: 200rpx;
  1135. margin-left: 35rpx;
  1136. .car_image{
  1137. width: 160rpx;
  1138. height: 160rpx;
  1139. margin: 20rpx 0rpx;
  1140. border-radius: 5rpx;
  1141. }
  1142. }
  1143. .box_right{
  1144. float: left;
  1145. width: 485rpx;
  1146. margin-left: 35rpx;
  1147. padding-top: 20rpx;
  1148. .car_name{
  1149. max-height: 80rpx;
  1150. font-size: 30rpx;
  1151. line-height: 40rpx;
  1152. overflow: hidden;
  1153. padding: 0rpx 0rpx;
  1154. }
  1155. .car_spec{
  1156. color: #999999;
  1157. font-size: 24rpx;
  1158. line-height: 30rpx;
  1159. padding: 0rpx 0rpx;
  1160. }
  1161. .stock_price{
  1162. width: 485rpx;
  1163. color: #dddddd;
  1164. font-size: 20rpx;
  1165. overflow: hidden;
  1166. margin-top: 10rpx;
  1167. line-height: 30rpx;
  1168. .product_price{
  1169. float: left;
  1170. color: red;
  1171. font-size: 30rpx;
  1172. line-height: 60rpx;
  1173. .car_market{
  1174. font-size: 24rpx;
  1175. color: #999999;
  1176. line-height: 30rpx;
  1177. vertical-align: middle;
  1178. text-decoration: line-through;
  1179. }
  1180. }
  1181. .product_quantity_box{
  1182. float: right;
  1183. color: #333333;
  1184. overflow: hidden;
  1185. font-size: 24rpx;
  1186. margin-top: 10rpx;
  1187. text-align: center;
  1188. .product_quantity_sub{
  1189. float: left;
  1190. border: none;
  1191. height: 36rpx;
  1192. background: none;
  1193. text-align: center;
  1194. line-height: 36rpx;
  1195. padding: 10rpx 10rpx;
  1196. .sub_icon{
  1197. width: 22rpx;
  1198. height: 22rpx;
  1199. display: block;
  1200. }
  1201. }
  1202. .product_quantity_sub::after{
  1203. border: none;
  1204. background: none;
  1205. }
  1206. .product_quantity{
  1207. float: left;
  1208. width: 100rpx;
  1209. height: 36rpx;
  1210. font-size: 24rpx;
  1211. min-height: 36rpx;
  1212. line-height: 36rpx;
  1213. padding: 0rpx 0rpx;
  1214. border-radius: 8rpx;
  1215. border: 2rpx solid #dddddd;
  1216. }
  1217. .product_quantity_add{
  1218. float: left;
  1219. border: none;
  1220. height: 36rpx;
  1221. background: none;
  1222. text-align: center;
  1223. padding: 10rpx 10rpx;
  1224. line-height: 36rpx;
  1225. .add_icon{
  1226. width: 22rpx;
  1227. height: 22rpx;
  1228. display: block;
  1229. }
  1230. }
  1231. .product_quantity_add::after{
  1232. border: none;
  1233. background: none;
  1234. }
  1235. }
  1236. }
  1237. .product_stock{
  1238. font-size: 20rpx;
  1239. line-height: 60rpx;
  1240. }
  1241. }
  1242. }
  1243. .select_sku{
  1244. font-size: 28rpx;
  1245. padding: 20rpx 35rpx;
  1246. margin-bottom: 20rpx;
  1247. .scroll_max{
  1248. height: 440rpx;
  1249. .product_attr{
  1250. display: block;
  1251. overflow: hidden;
  1252. margin-bottom: 20rpx;
  1253. .spec_name{
  1254. display: block;
  1255. height: 40rpx;
  1256. font-size: 28rpx;
  1257. line-height: 40rpx;
  1258. }
  1259. .arrt_list{
  1260. display: block;
  1261. overflow: hidden;
  1262. background-color: #F5F5F5;
  1263. .arrt_option{
  1264. float: left;
  1265. font-size: 28rpx;
  1266. line-height: 40rpx;
  1267. text-align: center;
  1268. border-radius: 6rpx;
  1269. padding: 10rpx 20rpx;
  1270. margin: 10rpx 0rpx;
  1271. margin-right: 20rpx;
  1272. background-color: #EEEEEE;
  1273. }
  1274. .arrt_option.active {
  1275. color: #FFFFFF;
  1276. background-color: #fE6000;
  1277. }
  1278. }
  1279. }
  1280. }
  1281. }
  1282. .to_select_coupon{
  1283. font-size: 28rpx;
  1284. padding: 10rpx 35rpx;
  1285. margin-bottom: 20rpx;
  1286. .coupon_deduction{
  1287. color: red;
  1288. float: right;
  1289. }
  1290. }
  1291. .order_price{
  1292. font-size: 28rpx;
  1293. text-align: right;
  1294. margin: 0rpx 35rpx;
  1295. padding: 10rpx 0rpx;
  1296. border-top: 2rpx solid #DDDDDD;
  1297. .coupon_deduction{
  1298. color: red;
  1299. float: right;
  1300. }
  1301. }
  1302. .order_btn{
  1303. width: 700rpx;
  1304. height: 100rpx;
  1305. display: block;
  1306. margin: 0 auto;
  1307. margin-top: 60rpx;
  1308. line-height: 80rpx;
  1309. text-align: center;
  1310. font-size: 30rpx;
  1311. .to_car{
  1312. color: #FFFFFF;
  1313. float: right;
  1314. width: 700rpx;
  1315. height: 80rpx;
  1316. display: block;
  1317. overflow: hidden;
  1318. font-size: 30rpx;
  1319. line-height: 80rpx;
  1320. padding: 0rpx 0rpx;
  1321. border-radius: 40rpx;
  1322. border: 0rpx solid transparent;
  1323. background-color: #F59A23;
  1324. }
  1325. .to_car::after{
  1326. border: 0rpx solid transparent;
  1327. }
  1328. .to_order{
  1329. color: #FFFFFF;
  1330. float: right;
  1331. width: 700rpx;
  1332. height: 80rpx;
  1333. display: block;
  1334. font-size: 30rpx;
  1335. overflow: hidden;
  1336. line-height: 80rpx;
  1337. padding: 0rpx 0rpx;
  1338. border-radius: 40rpx;
  1339. background-color: #E03519;
  1340. border: 0rpx solid transparent;
  1341. }
  1342. .to_order::after{
  1343. border: 0rpx solid transparent;
  1344. }
  1345. }
  1346. }
  1347. .coupon_list{
  1348. display: block;
  1349. overflow: hidden;
  1350. min-height: 600rpx;
  1351. margin: 10rpx auto;
  1352. background: #FFFFFF;
  1353. padding-bottom: 50rpx;
  1354. .coupon_item{
  1355. height: 200rpx;
  1356. display: block;
  1357. margin: 10rpx auto;
  1358. border-bottom: 2rpx solid #DDDDDD;
  1359. .box_left{
  1360. float: left;
  1361. width: 160rpx;
  1362. height: 160rpx;
  1363. font-size: 20rpx;
  1364. text-align: center;
  1365. margin-left: 35rpx;
  1366. line-height: 60rpx;
  1367. margin-top: 20rpx;
  1368. background: pink;
  1369. .rebate{
  1370. width: 120rpx;
  1371. height: 60rpx;
  1372. margin: 0rpx auto;
  1373. line-height: 60rpx;
  1374. margin-top: 20rpx;
  1375. overflow: hidden;
  1376. white-space: nowrap;
  1377. text-overflow: ellipsis;
  1378. }
  1379. }
  1380. .box_right{
  1381. float: left;
  1382. width: 485rpx;
  1383. margin-left: 35rpx;
  1384. padding-top: 20rpx;
  1385. .coupon_title{
  1386. width: 485rpx;
  1387. max-height: 80rpx;
  1388. font-size: 30rpx;
  1389. overflow: hidden;
  1390. line-height: 40rpx;
  1391. padding: 0rpx 0rpx;
  1392. .coupon_name{
  1393. float: left;
  1394. height: 40rpx;
  1395. width: 380rpx;
  1396. }
  1397. .coupon_status{
  1398. width: 85rpx;
  1399. float: right;
  1400. color: #999999;
  1401. font-size: 24rpx;
  1402. }
  1403. }
  1404. .product_scope{
  1405. width: 485rpx;
  1406. height: 80rpx;
  1407. color: #999999;
  1408. font-size: 24rpx;
  1409. overflow: hidden;
  1410. line-height: 80rpx;
  1411. .check_label{
  1412. float: right;
  1413. display: block;
  1414. overflow: hidden;
  1415. padding: 20rpx 20rpx;
  1416. .isstd{
  1417. line-height: 40rpx;
  1418. }
  1419. .checkbox{
  1420. float: right;
  1421. width: 40rpx;
  1422. height: 40rpx;
  1423. }
  1424. }
  1425. }
  1426. .coupon_info{
  1427. width: 485rpx;
  1428. max-height: 80rpx;
  1429. font-size: 30rpx;
  1430. overflow: hidden;
  1431. line-height: 40rpx;
  1432. padding: 0rpx 0rpx;
  1433. .coupon_exp{
  1434. float: left;
  1435. font-size: 20rpx;
  1436. }
  1437. }
  1438. }
  1439. }
  1440. .coupon_item:last-child{
  1441. border-bottom: none;
  1442. }
  1443. }
  1444. .addr_list{
  1445. width: 730rpx;
  1446. display: block;
  1447. overflow: hidden;
  1448. margin: 0rpx auto;
  1449. min-height: 500rpx;
  1450. .addr_item{
  1451. display: block;
  1452. font-size: 24rpx;
  1453. overflow: hidden;
  1454. line-height: 40rpx;
  1455. padding: 15rpx 10rpx;
  1456. border-radius: 15rpx;
  1457. border-bottom: 2rpx solid #dddddd;
  1458. .radio_label{
  1459. width: 40rpx;
  1460. float: left;
  1461. height: 50rpx;
  1462. padding-top: 30rpx;
  1463. margin-right: 20rpx;
  1464. .radio_icon{
  1465. float: left;
  1466. width: 40rpx;
  1467. height: 40rpx;
  1468. }
  1469. }
  1470. .contact_user{
  1471. float: left;
  1472. width: 640rpx;
  1473. display: block;
  1474. height: 50rpx;
  1475. font-size: 24rpx;
  1476. line-height: 50rpx;
  1477. .contact_name{
  1478. font-size: 26rpx;
  1479. font-weight: bold;
  1480. margin-right: 16rpx;
  1481. }
  1482. .contact_default{
  1483. color: #F59A23;
  1484. font-size: 20rpx;
  1485. margin-left: 16rpx;
  1486. border: 1rpx solid #F59A23;
  1487. }
  1488. }
  1489. .contact_addr{
  1490. float: left;
  1491. width: 640rpx;
  1492. display: block;
  1493. font-size: 24rpx;
  1494. line-height: 30rpx;
  1495. padding: 10rpx 5rpx;
  1496. }
  1497. }
  1498. }
  1499. .create_box{
  1500. height: 140rpx;
  1501. display: block;
  1502. .create_addr{
  1503. width: 700rpx;
  1504. height: 80rpx;
  1505. display: block;
  1506. color: #FFFFFF;
  1507. font-size: 30rpx;
  1508. overflow: hidden;
  1509. line-height: 80rpx;
  1510. padding: 0rpx 0rpx;
  1511. text-align: center;
  1512. margin: 0rpx auto;
  1513. margin-top: 20rpx;
  1514. border-radius: 40rpx;
  1515. background-color: #E03519;
  1516. }
  1517. }
  1518. }
  1519. </style>