景徳镇旅游微信小程序
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.

364 lines
6.9 KiB

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