酒店桌布为微信小程序
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.

524 lines
11 KiB

8 months ago
7 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
8 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
8 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
8 months ago
7 months ago
8 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
  1. <template>
  2. <view class="page">
  3. <navbar title="我要水洗" leftClick @leftClick="$utils.navigateBack" />
  4. <!-- <view class="tabs">
  5. <uv-tabs :list="tabs"
  6. :activeStyle="{color : '#FD5100', fontWeight : 600}"
  7. lineColor="#FD5100" lineHeight="8rpx"
  8. lineWidth="50rpx"
  9. :current="current"
  10. :scrollable="false"
  11. @click="clickTabs"></uv-tabs>
  12. </view> -->
  13. <!-- 选择租赁物品 -->
  14. <view class="box d">
  15. <uv-radio-group shape="circle" v-model="radiovalue">
  16. <!-- <uv-checkbox-group shape="circle" v-model="checkboxValue"
  17. > -->
  18. <view v-for="(item, index) in list" :key="index" class="item">
  19. <view class="checkbox">
  20. <uv-radio
  21. :name="item.id"
  22. :disabled="!!item.statusInfo"
  23. activeColor="#FA5A0A"
  24. size="40rpx"
  25. icon-size="35rpx"></uv-radio>
  26. </view>
  27. <image class="image" :src="item.goodsPic || 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg'"
  28. mode=""></image>
  29. <view class="info">
  30. <view class="title">
  31. <view class="text-ellipsis">{{ item.goodsName }}</view>
  32. <view style="flex-shrink: 0;">
  33. 数量{{ item.num }}
  34. </view>
  35. </view>
  36. <view class="unit">
  37. 规格{{ item.sku }}
  38. </view>
  39. <view class="wan" v-if="item.statusInfo">
  40. {{ item.statusInfo }}
  41. </view>
  42. <view class="price" v-else>
  43. <view class="" v-if="item.zujin">
  44. 租金
  45. <text>{{ item.zujin }}</text>
  46. </view>
  47. <view class="" v-if="item.washPrice">
  48. 水洗费
  49. <text>
  50. {{
  51. ((item.washUnitPrice || 0) * item.selectNum)
  52. .toFixed(2)
  53. }}
  54. </text>
  55. </view>
  56. </view>
  57. <view class="unit">
  58. <uv-number-box
  59. v-model="item.selectNum"
  60. :max="item.num"
  61. >
  62. </uv-number-box>
  63. </view>
  64. </view>
  65. </view>
  66. <!-- </uv-checkbox-group> -->
  67. </uv-radio-group>
  68. </view>
  69. <!-- <view class="btn" @click="submit">
  70. <button class="a">水洗下单<text v-if="price">{{price}}</text></button>
  71. </view> -->
  72. <view class="action">
  73. <view class="icon">
  74. <image src="/static/image/cart/1.png" mode=""></image>
  75. <view class="num">{{ checkboxValue.length }}</view>
  76. </view>
  77. <view class="price">
  78. <view class="count">
  79. 合计
  80. <view>
  81. <text>{{ price }}</text>
  82. </view>
  83. </view>
  84. <view class="text">
  85. <!-- {{ checkboxValue.length }}已享受更低优惠 -->
  86. 含租金{{ rentPrice && rentPrice.toFixed(2) }}
  87. 水洗费{{ washPrice && washPrice.toFixed(2) }}
  88. </view>
  89. </view>
  90. <view class="btn2" @click="goCleaning">结算</view>
  91. </view>
  92. <cartSubmitSelect
  93. @submit="ordersPay"
  94. :price="price"
  95. :washPrice="washPrice"
  96. :rentPrice="rentPrice"
  97. submiitTitle="立即水洗"
  98. ref="cartSubmitSelect"/>
  99. <view
  100. @click="$refs.addLease.open()"
  101. class="plus-create">
  102. <uv-icon
  103. name="plus"
  104. color="#fff"
  105. size="40rpx"
  106. ></uv-icon>
  107. </view>
  108. <addLease ref="addLease" @submit="getData"/>
  109. </view>
  110. </template>
  111. <script>
  112. import cartSubmitSelect from '@/components/user/cartSubmitSelect.vue'
  113. import mixinsList from '@/mixins/list.js'
  114. import mixinLease from '@/mixins/lease.js'
  115. import addLease from '../components/product/addLease.vue'
  116. export default {
  117. mixins : [mixinsList, mixinLease],
  118. components: {
  119. cartSubmitSelect,
  120. addLease,
  121. },
  122. data() {
  123. return {
  124. checkboxValue : [],
  125. radiovalue : 0,
  126. // statusText : ['正常', '换货中', '退货中'],
  127. tabs: [{
  128. name: '选择租赁物品'
  129. },
  130. {
  131. name: '选择我的物品'
  132. },
  133. ],
  134. current : 0,//当前选中的标签页
  135. mixinsListApi : 'getLeasePage',
  136. rentPrice : 0,//需要支付的租金
  137. }
  138. },
  139. computed : {
  140. price(){
  141. let price = parseFloat(this.washPrice) + parseFloat(this.rentPrice)
  142. if(price){
  143. return (this.washPrice + this.rentPrice).toFixed(2)
  144. }
  145. return 0
  146. },
  147. washPrice(){
  148. // if(this.checkboxValue.length == 0){
  149. // return 0
  150. // }
  151. let price = 0
  152. this.list.forEach(n => {
  153. // if(this.checkboxValue.includes(n.id)){
  154. // price += (n.washUnitPrice || 0) * n.selectNum
  155. // }
  156. if(this.radiovalue == n.id){
  157. price += (n.washUnitPrice || 0) * n.selectNum
  158. }
  159. })
  160. return price
  161. },
  162. zujin(){
  163. // if(this.checkboxValue.length == 0){
  164. // return 0
  165. // }
  166. if(this.list.length == 0){
  167. return 0
  168. }
  169. let price = 0
  170. this.list.forEach(n => {
  171. // if(this.checkboxValue.includes(n.id)){
  172. price += n.zujin || 0
  173. // }
  174. })
  175. return price
  176. },
  177. },
  178. onLoad(args) {
  179. if(args.id){
  180. // this.checkboxValue = [args.id]
  181. this.current = 1
  182. }
  183. },
  184. onShow() {
  185. this.getData()
  186. this.getRentPrice()
  187. },
  188. methods: {
  189. //点击tab栏
  190. clickTabs({
  191. index,
  192. name
  193. }) {
  194. this.current = index
  195. this.queryParams.pageSize = 10
  196. this.checkboxValue = []
  197. // this.mixinsListApi = ['orderPage', 'orderPage'][index]
  198. this.getData()
  199. },
  200. // 发请求之前处理参数
  201. beforeGetData(){
  202. let data = {}
  203. // data.leaseFlag = this.current ? 0 : 1;
  204. return data
  205. },
  206. getDataThen(list){
  207. // list[0] && list[0].d = true
  208. list.forEach(n => {
  209. n.statusInfo = this.isLeaseStatus(n)
  210. n.selectNum = n.num
  211. })
  212. },
  213. // 去结算按钮
  214. goCleaning() {
  215. // if (this.checkboxValue.length < 1) {
  216. // uni.showToast({
  217. // title: "请勾选商品",
  218. // icon: 'none'
  219. // })
  220. // return
  221. // }
  222. if (this.radiovalue == 0) {
  223. uni.showToast({
  224. title: "请勾选商品",
  225. icon: 'none'
  226. })
  227. return
  228. }
  229. this.$refs.cartSubmitSelect.open('bottom')
  230. },
  231. //商品下单
  232. ordersPay({ addressId, couponId }) {
  233. var self = this
  234. // var deleteCartIds = this.checkboxValue.join(",") //待删除的购物车id
  235. let data = []
  236. let records = this.list
  237. for (var i = 0; i < records.length; i++) {
  238. // if (this.checkboxValue.includes(records[i].id)) {
  239. // data.push({
  240. // leaseId: records[i].id, //租赁id
  241. // addressId, //地址id
  242. // type : 1,
  243. // num : records[i].selectNum
  244. // })
  245. // }
  246. if (this.radiovalue == records[i].id) {
  247. data.push({
  248. leaseId: records[i].id, //租赁id
  249. addressId, //地址id
  250. type : 1,
  251. num : records[i].selectNum
  252. })
  253. }
  254. }
  255. this.$api('orderCreate', {
  256. req: JSON.stringify(data)
  257. }, res => {
  258. if (res.code == 200) {
  259. let form = {
  260. id: res.result.id
  261. }
  262. if(couponId){
  263. form.couponId = couponId
  264. }
  265. this.$api('orderPay', form, res => {
  266. if (res.code == 200) {
  267. uni.requestPayment({
  268. provider: 'wxpay', // 服务提提供商
  269. timeStamp: res.result.timeStamp, // 时间戳
  270. nonceStr: res.result.nonceStr, // 随机字符串
  271. package: res.result.packageValue,
  272. signType: res.result.signType, // 签名算法
  273. paySign: res.result.paySign, // 签名
  274. success: function(res) {
  275. console.log('支付成功', res);
  276. uni.redirectTo({
  277. url: '/pages/index/order'
  278. })
  279. },
  280. fail: function(err) {
  281. console.log('支付失败', err);
  282. // self.$refs.confirmationPopup.close()
  283. uni.redirectTo({
  284. url: '/pages/index/order'
  285. })
  286. uni.showToast({
  287. icon: 'none',
  288. title: "支付失败"
  289. })
  290. }
  291. });
  292. }
  293. })
  294. }
  295. })
  296. },
  297. // 获取需要支付的租金
  298. getRentPrice(){
  299. this.$api('getRentPrice', res => {
  300. if(res.code == 200){
  301. this.rentPrice = res.result
  302. }
  303. })
  304. },
  305. }
  306. }
  307. </script>
  308. <style scoped lang="scss">
  309. .page {
  310. padding-bottom: 200rpx;
  311. .tabs{
  312. position: sticky;
  313. top: calc(var(--status-bar-height) + 120rpx);
  314. background-color: #fff;
  315. // padding-top: 20rpx;
  316. }
  317. .btn {
  318. display: flex;
  319. justify-content: center;
  320. position: fixed;
  321. bottom: 20rpx;
  322. width: 100%;
  323. .a {
  324. display: flex;
  325. justify-content: center;
  326. align-items: center;
  327. width: 70%;
  328. height: 100rpx;
  329. color: #FFF;
  330. background-color: $uni-color;
  331. border: 1px solid red;
  332. border-radius: 100rpx;
  333. font-size: 30rpx;
  334. }
  335. }
  336. .d{
  337. .item {
  338. background-color: #fff;
  339. display: flex;
  340. padding: 30rpx;
  341. width: 690rpx;
  342. .checkbox {
  343. display: flex;
  344. justify-content: center;
  345. align-items: center;
  346. flex-shrink: 0;
  347. }
  348. .image {
  349. width: 200rpx;
  350. height: 200rpx;
  351. border-radius: 20rpx;
  352. }
  353. .info {
  354. flex: 1;
  355. .title {
  356. display: flex;
  357. padding: 6rpx 20rpx;
  358. justify-content: space-between;
  359. .text-ellipsis{
  360. width: 280rpx;
  361. overflow: hidden; //超出的文本隐藏
  362. text-overflow: ellipsis; //溢出用省略号显示
  363. white-space: nowrap; //溢出不换行
  364. }
  365. }
  366. .unit {
  367. font-size: 24rpx;
  368. padding: 6rpx 20rpx;
  369. color: #717171;
  370. }
  371. .price {
  372. color: $uni-color;
  373. font-size: 24rpx;
  374. padding: 6rpx 20rpx;
  375. display: flex;
  376. justify-content: space-between;
  377. text {
  378. font-weight: 900;
  379. }
  380. }
  381. .wan{
  382. color: $uni-color;
  383. font-size: 26rpx;
  384. padding: 10rpx 20rpx;
  385. }
  386. }
  387. }
  388. }
  389. .action {
  390. width: 700rpx;
  391. position: fixed;
  392. bottom: 20rpx;
  393. left: 25rpx;
  394. background-color: #fff;
  395. height: 130rpx;
  396. border-radius: 65rpx;
  397. box-shadow: 0 0 6rpx 6rpx #00000010;
  398. display: flex;
  399. justify-content: center;
  400. align-items: center;
  401. overflow: hidden;
  402. .icon {
  403. position: relative;
  404. width: 80rpx;
  405. height: 80rpx;
  406. margin: 0 20rpx;
  407. image {
  408. width: 80rpx;
  409. height: 80rpx;
  410. }
  411. .num {
  412. position: absolute;
  413. right: 10rpx;
  414. top: 0rpx;
  415. background-color: $uni-color;
  416. color: #fff;
  417. font-size: 18rpx;
  418. border-radius: 50%;
  419. height: 30rpx;
  420. width: 30rpx;
  421. display: flex;
  422. justify-content: center;
  423. align-items: center;
  424. }
  425. }
  426. .price {
  427. .count {
  428. display: flex;
  429. font-size: 26rpx;
  430. align-items: center;
  431. view {
  432. color: $uni-color;
  433. margin-left: 10rpx;
  434. text {
  435. font-size: 32rpx;
  436. font-weight: 900;
  437. }
  438. }
  439. }
  440. .text {
  441. font-size: 22rpx;
  442. color: #717171;
  443. }
  444. }
  445. .btn2 {
  446. margin-left: auto;
  447. background-color: $uni-color;
  448. height: 100%;
  449. padding: 0 50rpx;
  450. color: #fff;
  451. display: flex;
  452. justify-content: center;
  453. align-items: center;
  454. }
  455. }
  456. .plus-create{
  457. position: fixed;
  458. right: 50rpx;
  459. bottom: 30vh;
  460. background-color: $uni-color;
  461. color: #FFF;
  462. width: 100rpx;
  463. height: 100rpx;
  464. border-radius: 50%;
  465. display: flex;
  466. justify-content: center;
  467. align-items: center;
  468. }
  469. }
  470. </style>