|
@@ -0,0 +1,129 @@
|
|
|
+import { computed, ref, defineComponent, onMounted } from 'vue'
|
|
|
+import {
|
|
|
+ Card,
|
|
|
+ Cell,
|
|
|
+ CellGroup,
|
|
|
+ Checkbox,
|
|
|
+ Image,
|
|
|
+ Radio,
|
|
|
+ RadioGroup,
|
|
|
+ SubmitBar
|
|
|
+} from 'vant'
|
|
|
+import { carts } from '../cart'
|
|
|
+import styles from '../index.module.less'
|
|
|
+import iconWx from '@views/shop-mall/images/icon-wx.png'
|
|
|
+import iconZfb from '@views/shop-mall/images/icon-zfb.png'
|
|
|
+import Address from '../components/address'
|
|
|
+export default defineComponent({
|
|
|
+ setup() {
|
|
|
+ const list = carts.list
|
|
|
+
|
|
|
+ const len = computed(() => {
|
|
|
+ return list.length
|
|
|
+ })
|
|
|
+ const totalPrice = computed(() => {
|
|
|
+ let price = 0
|
|
|
+ list.forEach((n: any) => {
|
|
|
+ price += n.price * n.quantity
|
|
|
+ })
|
|
|
+ return ((price * 100) / 100).toFixed(2)
|
|
|
+ })
|
|
|
+ onMounted(() => {
|
|
|
+ console.log(list, '确认订单商品')
|
|
|
+ })
|
|
|
+
|
|
|
+ const payType = ref('wx')
|
|
|
+ return () => (
|
|
|
+ <div class={styles.cartConfirm}>
|
|
|
+ <div class={styles.cartConfirmBox}>
|
|
|
+ <Address />
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ style={{ marginTop: '20px' }}
|
|
|
+ class={[styles.cartBox, styles.cartConfirmBox]}
|
|
|
+ >
|
|
|
+ {list.map((item: any) => (
|
|
|
+ <div class={styles.cartItem}>
|
|
|
+ <Card
|
|
|
+ price={((item.price * item.quantity * 100) / 100).toFixed(2)}
|
|
|
+ desc={item.productAttr}
|
|
|
+ title={item.productName}
|
|
|
+ thumb={item.productPic}
|
|
|
+ num={item.quantity}
|
|
|
+ ></Card>
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ <CellGroup border={false}>
|
|
|
+ <Cell
|
|
|
+ border={false}
|
|
|
+ title="总额"
|
|
|
+ value={'¥ ' + totalPrice.value}
|
|
|
+ ></Cell>
|
|
|
+ <Cell border={false} title="运费" value="¥ 0.00"></Cell>
|
|
|
+ <Cell border={false} title="优惠卷" value="暂无可用优惠卷"></Cell>
|
|
|
+ <Cell border={false} title="乐乐币抵扣" value="-¥ 0.00"></Cell>
|
|
|
+ </CellGroup>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div
|
|
|
+ class={[styles.cartConfirmBox, styles.payWrap]}
|
|
|
+ style={{ marginTop: '20px' }}
|
|
|
+ >
|
|
|
+ <RadioGroup v-model={payType.value}>
|
|
|
+ <Cell
|
|
|
+ border={false}
|
|
|
+ v-slots={{
|
|
|
+ title: () => (
|
|
|
+ <div class={styles.payType}>
|
|
|
+ <Image class={styles.payIcon} src={iconWx}></Image>
|
|
|
+ <span
|
|
|
+ style={{
|
|
|
+ marginLeft: '14px',
|
|
|
+ fontSize: '14px',
|
|
|
+ fontWeight: 500
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 微信支付
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ ),
|
|
|
+ value: () => <Radio name="wx"></Radio>
|
|
|
+ }}
|
|
|
+ onClick={() => (payType.value = 'wx')}
|
|
|
+ ></Cell>
|
|
|
+ <Cell
|
|
|
+ v-slots={{
|
|
|
+ title: () => (
|
|
|
+ <div class={styles.payType}>
|
|
|
+ <Image class={styles.payIcon} src={iconZfb}></Image>
|
|
|
+ <span
|
|
|
+ style={{
|
|
|
+ marginLeft: '14px',
|
|
|
+ fontSize: '14px',
|
|
|
+ fontWeight: 500
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 支付宝支付
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ ),
|
|
|
+ value: () => <Radio name="zfb"></Radio>
|
|
|
+ }}
|
|
|
+ onClick={() => (payType.value = 'zfb')}
|
|
|
+ ></Cell>
|
|
|
+ </RadioGroup>
|
|
|
+ </div>
|
|
|
+ <SubmitBar
|
|
|
+ buttonText={`结算(${len.value})`}
|
|
|
+ buttonColor="var(--van-primary)"
|
|
|
+ disabled={len.value === 0}
|
|
|
+ >
|
|
|
+ <div class={styles.confirmBottom}>
|
|
|
+ 合计 <span class={styles['price-des']}>¥{totalPrice.value}</span>
|
|
|
+ </div>
|
|
|
+ </SubmitBar>
|
|
|
+ <div style={{height: 'var(--van-submit-bar-height)'}}></div>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+})
|