123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- <template>
- <!-- 购买记录 -->
- <div class="Purchasehitory">
- <div class="cut">
- <div class="sele">
- <div
- @click="SelectShowEvent('1')"
- :class="SelectShow == '1' ? 'select' : ''"
- >
- 已购买
- </div>
- <div
- @click="SelectShowEvent('2')"
- :class="SelectShow == '1' ? '' : 'select'"
- >
- 待付款
- </div>
- </div>
- </div>
- <div class="list">
- <!-- 已购买 -->
- <div v-if="SelectShow == '1'" class="haveBought">
- <div>
- <div class="image">
- <img src="../../assets/Personalcenter/image/img1.png" alt="" />
- </div>
- <div class="text">
- <p class="title">
- <span>Learn Chinese with Ease-Learn Chinese with Ease</span>
- <span>2021-05-21 16:43:12</span>
- </p>
- <p>Beijing language and Culture University</p>
- <p>Esther Howard</p>
- <div class="buy">
- <span class="price">
- $
- <span class="price_1" v-text="changePrice('1', '19.99')"></span>
- <span class="price_2" v-text="changePrice('2', '19.99')"></span>
- </span>
- <button>已购买</button>
- </div>
- </div>
- </div>
- </div>
- <!-- 待付款 -->
- <div v-else class="obligation">
- <div>
- <div class="image">
- <img src="../../assets/Personalcenter/image/img1.png" alt="" />
- </div>
- <div class="text">
- <p class="title">
- <span>Learn Chinese with Ease-Learn Chinese with Ease</span>
- <span>2021-05-21 16:43:12</span>
- </p>
- <p>Beijing language and Culture University</p>
- <p>Esther Howard</p>
- <div class="buy">
- <span class="price">
- $
- <span class="price_1" v-text="changePrice('1', '19.99')"></span>
- <span class="price_2" v-text="changePrice('2', '19.99')"></span>
- </span>
- <button>购买</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- //例如:import 《组件名称》from ‘《组件路径》';
- export default {
- //import引入的组件需要注入到对象中才能使用
- components: {},
- props: {},
- data() {
- //这里存放数据
- return {
- SelectShow: "1",
- };
- },
- //计算属性 类似于data概念
- computed: {},
- //监控data中数据变化
- watch: {},
- //方法集合
- methods: {
- // 选择已购买还是待付款
- SelectShowEvent(num) {
- this.SelectShow = num;
- },
- // 处理价格
- changePrice(type, item) {
- if (item.indexOf(".") != -1) {
- if (type == 1) {
- return item.split(".")[0];
- } else if (type == 2) {
- return "." + item.split(".")[1];
- }
- } else {
- if (type == 1) {
- return item;
- }
- }
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {},
- //生命周期-创建之前
- beforeCreated() {},
- //生命周期-挂载之前
- beforeMount() {},
- //生命周期-更新之前
- beforUpdate() {},
- //生命周期-更新之后
- updated() {},
- //生命周期-销毁之前
- beforeDestory() {},
- //生命周期-销毁完成
- destoryed() {},
- //如果页面有keep-alive缓存功能,这个函数会触发
- activated() {},
- };
- </script>
- <style lang="scss" scoped>
- /* @import url(); 引入css类 */
- .Purchasehitory {
- .cut {
- margin: 32px;
- .sele {
- width: 318px;
- height: 48px;
- background: #ebebeb;
- border-radius: 30px;
- color: #9f9f9f;
- font-size: 20px;
- display: flex;
- align-items: center;
- > div {
- width: 158px;
- height: 48px;
- border-radius: 30px;
- line-height: 48px;
- text-align: center;
- cursor: pointer;
- }
- .select {
- background: #ff9900;
- color: white;
- box-shadow: 0px 2px 8px rgba(255, 153, 0, 0.15);
- }
- }
- }
- .list {
- .haveBought {
- > div {
- display: flex;
- height: 160px;
- width: 100%;
- padding: 16px 16px 16px 32px;
- border-bottom: 1px solid #9f9f9f;
- .image {
- img {
- width: 96px;
- height: 128px;
- }
- }
- .text {
- width: 800px;
- margin-left: 16px;
- margin-right: 16px;
- p {
- margin: 0;
- font-size: 16px;
- }
- .title {
- font-weight: 600;
- color: #2c2c2c;
- display: flex;
- justify-content: space-between;
- :nth-child(2) {
- color: #2c2c2c;
- opacity: 0.7;
- }
- }
- p:not(.title) {
- margin-top: 8px;
- color: #2c2c2c;
- opacity: 0.7;
- }
- .buy {
- text-align: right;
- button {
- width: 120px;
- height: 40px;
- background: #d5d5d5;
- border-radius: 4px;
- border: none;
- outline: none;
- cursor: pointer;
- color: white;
- margin-left: 16px;
- }
- }
- }
- }
- }
- .obligation {
- > div {
- display: flex;
- height: 160px;
- width: 100%;
- padding: 16px 16px 16px 32px;
- border-bottom: 1px solid #9f9f9f;
- .image {
- img {
- width: 96px;
- height: 128px;
- }
- }
- .text {
- width: 800px;
- margin-left: 16px;
- margin-right: 16px;
- p {
- margin: 0;
- font-size: 16px;
- }
- .title {
- font-weight: 600;
- color: #2c2c2c;
- display: flex;
- justify-content: space-between;
- :nth-child(2) {
- color: #2c2c2c;
- opacity: 0.7;
- }
- }
- p:not(.title) {
- margin-top: 8px;
- color: #2c2c2c;
- opacity: 0.7;
- }
- .buy {
- text-align: right;
- button {
- width: 120px;
- height: 40px;
- background: #ff9900;
- border-radius: 4px;
- border: none;
- outline: none;
- cursor: pointer;
- color: white;
- margin-left: 16px;
- }
- }
- }
- }
- }
- .price {
- font-weight: 600;
- font-size: 24px;
- .price_2 {
- font-size: 16px;
- }
- }
- }
- }
- </style>
|