瑶都万能墙
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

399 lines
7.8 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <uv-popup ref="popup"
  3. :round="30"
  4. bgColor="#f7f7f7">
  5. <view class="content">
  6. <!-- 地址 -->
  7. <view class="address"
  8. @click="openAddress">
  9. <image src="../../static/address/selectIcon.png" mode=""></image>
  10. <view class="">
  11. {{ address.name }}
  12. </view>
  13. <view class="">
  14. {{ address.addressDetail }}
  15. </view>
  16. <view class="icon">
  17. <uv-icon
  18. size="30rpx"
  19. name="arrow-right"></uv-icon>
  20. </view>
  21. </view>
  22. <!-- 商品信息和数量 -->
  23. <view class="submit-info">
  24. <view class="title">
  25. {{ detail.name }}
  26. </view>
  27. <view class="box">
  28. <image
  29. class="image"
  30. :src="detail.image && detail.image.split(',')[0]"
  31. mode=""></image>
  32. <view class="info">
  33. <view class="price">
  34. 价格<text>{{ detail.price }}</text>
  35. </view>
  36. <!-- <view class="unit">
  37. 请选择规格
  38. </view> -->
  39. <view class="favorable" v-if="detail.points">
  40. <view class="t">
  41. 积分兑换
  42. </view>
  43. <view class="p">
  44. {{ detail.points }}
  45. </view>
  46. </view>
  47. <view class="">
  48. <uv-number-box v-model="num"></uv-number-box>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 规格 -->
  54. <!-- <view class="submit-unit">
  55. <view class="title">
  56. 规格选择
  57. </view>
  58. <view class="list">
  59. <view :class="{act : unitIndex == index}"
  60. v-for="(item, index) in detail.hotelGoodsSkuList"
  61. @click="selectUnit(item, index)"
  62. :key="index">
  63. {{ item.title }}
  64. </view>
  65. </view>
  66. </view> -->
  67. <!-- 费用明细 -->
  68. <view class="expense-detail">
  69. <view class="title">
  70. 费用明细
  71. </view>
  72. <view class="detail">
  73. 积分{{ detail.points }}
  74. </view>
  75. </view>
  76. <!-- 提交按钮 -->
  77. <view class="submit-btn">
  78. <!-- <view class="l"
  79. @click="addCart">
  80. 加入租赁车
  81. </view> -->
  82. <view class="r"
  83. @click="orderPay">
  84. {{ submiitTitle }}
  85. </view>
  86. </view>
  87. </view>
  88. <uv-popup ref="addressPopup" :round="30">
  89. <addressList
  90. ref="addressList"
  91. height="60vh"
  92. @select="selectAddress"
  93. />
  94. </uv-popup>
  95. </uv-popup>
  96. </template>
  97. <script>
  98. import addressList from '../address/addressList.vue'
  99. export default {
  100. components : {
  101. addressList,
  102. },
  103. props : {
  104. submiitTitle : {
  105. default : '立即兑换',
  106. type : String,
  107. },
  108. detail : {
  109. default : {}
  110. }
  111. },
  112. data() {
  113. return {
  114. unitIndex : 0,
  115. address : {
  116. name : '请选择联系人',
  117. addressDetail : '',
  118. },
  119. num : 1,
  120. unit : {},
  121. addressTotal : 0,
  122. }
  123. },
  124. methods: {
  125. // 打开
  126. open(){
  127. this.$refs.popup.open('bottom')
  128. // if(!this.unit.id){
  129. // this.selectUnit(this.detail.hotelGoodsSkuList[0], 0)
  130. // }
  131. // 获取地址列表
  132. this.$refs.addressList.getAddressList().then(res => {
  133. this.addressTotal = res.total
  134. if(this.addressTotal != 0){
  135. this.address = res.records[0]
  136. }
  137. })
  138. },
  139. // 关闭
  140. close(){
  141. this.$refs.popup.close()
  142. },
  143. // 打开选择地址
  144. openAddress(){
  145. if (this.addressTotal == 0) {
  146. this.$refs.popup.close()
  147. return uni.navigateTo({
  148. url: '/pages_order/mine/address?type=back'
  149. })
  150. }
  151. this.$refs.addressPopup.open('bottom')
  152. },
  153. // 选择地址
  154. selectAddress(e){
  155. this.address = e
  156. this.$refs.addressPopup.close()
  157. },
  158. // 选择规格
  159. selectUnit(item, index){
  160. this.unit = item
  161. this.unitIndex = index
  162. },
  163. addCart(){
  164. this.$api('cartAdd', {
  165. id : this.detail.id,
  166. skuId : this.unit.id,
  167. }, res => {
  168. if(res.code == 200){
  169. uni.showToast({
  170. title: '添加成功',
  171. });
  172. this.$refs.popup.close()
  173. }
  174. })
  175. },
  176. orderPay(){
  177. let data = {
  178. shopId : this.detail.id,//商品id
  179. // skuId : this.unit.id,//规格id
  180. addressId : this.address.id,//地址id
  181. // sku : this.unit.title,//规格
  182. num : this.num,
  183. }
  184. if(this.$utils.verificationAll(data, {
  185. // skuId : '请选择规格',
  186. addressId : '请选择地址',
  187. })){
  188. return
  189. }
  190. this.$api('createPointsOrder', data, res => {
  191. if(res.code == 200){
  192. uni.redirectTo({
  193. url: '/pages/index/order'
  194. })
  195. // uni.requestPayment({
  196. // provider: 'wxpay', // 服务提提供商
  197. // timeStamp: res.result.timeStamp, // 时间戳
  198. // nonceStr: res.result.nonceStr, // 随机字符串
  199. // package: res.result.packageValue,
  200. // signType: res.result.signType, // 签名算法
  201. // paySign: res.result.paySign, // 签名
  202. // success: function (res) {
  203. // console.log('支付成功',res);
  204. // uni.redirectTo({
  205. // url: '/pages/index/order'
  206. // })
  207. // },
  208. // fail: function (err) {
  209. // console.log('支付失败',err);
  210. // uni.showToast({
  211. // icon:'none',
  212. // title:"支付失败"
  213. // })
  214. // }
  215. // });
  216. }
  217. })
  218. },
  219. }
  220. }
  221. </script>
  222. <style scoped lang="scss">
  223. .content{
  224. max-height: 80vh;
  225. overflow: hidden;
  226. overflow-y: auto;
  227. .address{
  228. display: flex;
  229. padding: 20rpx;
  230. background-color: #fff;
  231. image{
  232. width: 30rpx;
  233. height: 30rpx;
  234. margin: 20rpx;
  235. }
  236. view{
  237. margin: 20rpx;
  238. overflow:hidden; //超出的文本隐藏
  239. text-overflow:ellipsis; //溢出用省略号显示
  240. white-space:nowrap; //溢出不换行
  241. }
  242. .icon{
  243. margin-left: auto;
  244. }
  245. }
  246. .submit-info{
  247. background-color: #fff;
  248. padding: 30rpx;
  249. margin-top: 20rpx;
  250. .title{
  251. font-size: 30rpx;
  252. padding: 10rpx;
  253. font-weight: 600;
  254. }
  255. .box{
  256. display: flex;
  257. margin-top: 10rpx;
  258. .image{
  259. width: 200rpx;
  260. height: 200rpx;
  261. border-radius: 20rpx;
  262. margin-right: 20rpx;
  263. }
  264. .info{
  265. flex: 1;
  266. .unit{
  267. font-size: 24rpx;
  268. padding: 10rpx 20rpx;
  269. color: #717171;
  270. display: flex;
  271. align-items: center;
  272. }
  273. .price{
  274. color: $uni-price-color;
  275. font-size: 28rpx;
  276. padding: 10rpx 20rpx;
  277. text{
  278. font-size: 36rpx;
  279. font-weight: 900;
  280. }
  281. }
  282. .favorable{
  283. margin-left: 10rpx;
  284. display: flex;
  285. // background-image: url(/static/image/product/favorable.png);
  286. background-size: 100% 100%;
  287. width: fit-content;
  288. font-size: 22rpx;
  289. margin-top: 6rpx;
  290. margin-bottom: 6rpx;
  291. border-radius: 10rpx;
  292. overflow: hidden;
  293. background-color: #ff000011;
  294. .t{
  295. padding: 5rpx 10rpx;
  296. }
  297. .p{
  298. padding: 5rpx 10rpx;
  299. color: #fff;
  300. background-color: #F03F25;
  301. height: 100%;
  302. }
  303. }
  304. }
  305. }
  306. }
  307. .submit-unit{
  308. padding: 30rpx;
  309. background-color: #fff;
  310. .title{
  311. font-size: 28rpx;
  312. font-weight: 600;
  313. }
  314. .list{
  315. display: flex;
  316. flex-wrap: wrap;
  317. font-size: 22rpx;
  318. .act{
  319. color: $uni-price-color;
  320. border: 1px solid $uni-price-color;
  321. background-color: #F9E7DE;
  322. }
  323. view{
  324. border-radius: 15rpx;
  325. width: 320rpx;
  326. background-color: #F3F3F3;
  327. border: 1px solid #F3F3F3;
  328. margin: 10rpx;
  329. display: flex;
  330. justify-content: center;
  331. padding: 15rpx 0;
  332. }
  333. }
  334. }
  335. .expense-detail{
  336. padding: 30rpx;
  337. background-color: #fff;
  338. font-size: 28rpx;
  339. .title{
  340. font-weight: 600;
  341. }
  342. .detail{
  343. background-color: #F6F6F6;
  344. color: #717171;
  345. margin: 10rpx 0;
  346. padding: 10rpx 20rpx;
  347. }
  348. }
  349. .submit-btn{
  350. width: 600rpx;
  351. height: 80rpx;
  352. color: #fff;
  353. border-radius: 40rpx;
  354. font-size: 28rpx;
  355. margin: 20rpx auto;
  356. display: flex;
  357. justify-content: center;
  358. align-items: center;
  359. border: 1rpx solid $uni-price-color;
  360. overflow: hidden;
  361. .l{
  362. flex: 1;
  363. display: flex;
  364. justify-content: center;
  365. align-items: center;
  366. color: $uni-price-color;
  367. }
  368. .r{
  369. background: $uni-price-color;
  370. flex: 1;
  371. height: 100%;
  372. display: flex;
  373. justify-content: center;
  374. align-items: center;
  375. }
  376. }
  377. }
  378. </style>