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

362 lines
6.8 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 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. userName : '请选择联系人',
  110. address : '',
  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. waresId : this.detail.id,
  155. shopcarNumber : this.num,
  156. }, res => {
  157. if(res.code == 200){
  158. uni.showToast({
  159. title: res.message,
  160. icon: 'none'
  161. });
  162. this.$refs.popup.close()
  163. }
  164. })
  165. },
  166. orderPay(){
  167. let data = {
  168. id : this.detail.id,//商品id
  169. addressId : this.address.id,//地址id
  170. num : this.num,
  171. }
  172. if(this.$utils.verificationAll(data, {
  173. addressId : '请选择地址',
  174. })){
  175. return
  176. }
  177. this.$api('orderPay', data, res => {
  178. if(res.code == 200){
  179. uni.redirectTo({
  180. url: '/pages/index/order'
  181. })
  182. // uni.requestPayment({
  183. // provider: 'wxpay', // 服务提提供商
  184. // timeStamp: res.result.timeStamp, // 时间戳
  185. // nonceStr: res.result.nonceStr, // 随机字符串
  186. // package: res.result.packageValue,
  187. // signType: res.result.signType, // 签名算法
  188. // paySign: res.result.paySign, // 签名
  189. // success: function (res) {
  190. // console.log('支付成功',res);
  191. // uni.redirectTo({
  192. // url: '/pages/index/order'
  193. // })
  194. // },
  195. // fail: function (err) {
  196. // console.log('支付失败',err);
  197. // uni.showToast({
  198. // icon:'none',
  199. // title:"支付失败"
  200. // })
  201. // }
  202. // });
  203. }
  204. })
  205. },
  206. }
  207. }
  208. </script>
  209. <style scoped lang="scss">
  210. .content{
  211. max-height: 80vh;
  212. overflow: hidden;
  213. overflow-y: auto;
  214. .address{
  215. display: flex;
  216. padding: 20rpx;
  217. background-color: #fff;
  218. image{
  219. width: 30rpx;
  220. height: 30rpx;
  221. margin: 20rpx;
  222. }
  223. view{
  224. margin: 20rpx;
  225. overflow:hidden; //超出的文本隐藏
  226. text-overflow:ellipsis; //溢出用省略号显示
  227. white-space:nowrap; //溢出不换行
  228. }
  229. .icon{
  230. margin-left: auto;
  231. }
  232. }
  233. .submit-info{
  234. background-color: #fff;
  235. padding: 30rpx;
  236. margin-top: 20rpx;
  237. .title{
  238. font-size: 30rpx;
  239. padding: 10rpx;
  240. font-weight: 600;
  241. }
  242. .box{
  243. display: flex;
  244. margin-top: 10rpx;
  245. .image{
  246. width: 200rpx;
  247. height: 200rpx;
  248. border-radius: 20rpx;
  249. margin-right: 20rpx;
  250. }
  251. .info{
  252. flex: 1;
  253. .unit{
  254. font-size: 24rpx;
  255. padding: 10rpx 20rpx;
  256. color: #717171;
  257. display: flex;
  258. align-items: center;
  259. }
  260. .price{
  261. color: $uni-color;
  262. font-size: 28rpx;
  263. padding: 10rpx 20rpx;
  264. text{
  265. font-size: 36rpx;
  266. font-weight: 900;
  267. }
  268. }
  269. }
  270. }
  271. }
  272. .submit-unit{
  273. padding: 30rpx;
  274. background-color: #fff;
  275. .title{
  276. font-size: 28rpx;
  277. font-weight: 600;
  278. }
  279. .list{
  280. display: flex;
  281. flex-wrap: wrap;
  282. font-size: 22rpx;
  283. .act{
  284. color: $uni-color;
  285. border: 1px solid $uni-color;
  286. background-color: #F9E7DE;
  287. }
  288. view{
  289. border-radius: 15rpx;
  290. width: 320rpx;
  291. background-color: #F3F3F3;
  292. border: 1px solid #F3F3F3;
  293. margin: 10rpx;
  294. display: flex;
  295. justify-content: center;
  296. padding: 15rpx 0;
  297. }
  298. }
  299. }
  300. .expense-detail{
  301. padding: 30rpx;
  302. background-color: #fff;
  303. font-size: 28rpx;
  304. .title{
  305. font-weight: 600;
  306. }
  307. .detail{
  308. background-color: #F6F6F6;
  309. color: #717171;
  310. margin: 10rpx 0;
  311. padding: 10rpx 20rpx;
  312. }
  313. }
  314. .submit-btn{
  315. width: 600rpx;
  316. height: 80rpx;
  317. color: #fff;
  318. border-radius: 40rpx;
  319. font-size: 28rpx;
  320. margin: 20rpx auto;
  321. display: flex;
  322. justify-content: center;
  323. align-items: center;
  324. border: 1rpx solid $uni-color;
  325. overflow: hidden;
  326. .l{
  327. flex: 1;
  328. display: flex;
  329. justify-content: center;
  330. align-items: center;
  331. color: $uni-color;
  332. }
  333. .r{
  334. background: $uni-color;
  335. flex: 1;
  336. height: 100%;
  337. display: flex;
  338. justify-content: center;
  339. align-items: center;
  340. }
  341. }
  342. }
  343. </style>