123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- <template name="goods">
- <view class="goods-template">
- <!-- 商品列表 -->
- <view class="goods-list">
- <view v-for="(item, index) in goodsData" :key="index" class="goods-item">
- <view class="productlist">
- <view class="goods-pros-t">
- <view class="pros-img"><image :src="item.productPic" alt="" /></view>
- <view class="pros-product">
- <view class="producttitle">{{item.productName}}</view>
- <view class="productspec" v-for="(attr,idx) in item.productAttr" :key="idx">
- <text>{{attr.key}}:</text>
- <text>{{attr.value}}</text>
- </view>
- <view class="productprice">
- <view class="price">
- <text><text class="small">¥</text>{{item.price.toFixed(2)}}</text>
- </view>
- <view class="count">
- <text class="small">x</text>{{item.quantity}}
- </view>
- </view>
- </view>
- </view>
- <view class="goods-pros-m">
- <view class="m-text">留言:</view>
- <view class="m-input">
- <input type="text"
- v-model="remark[index]"
- @change="changeHandle(index)"
- placeholder-class="placeholder"
- maxlength="100"
- placeholder="选填,给商家留言"/>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default{
- name:"goods",
- props:{
- goodsData:{
- type:Array
- }
- },
- data() {
- return{
- remark:[]
- }
- },
- created(){
-
- },
- watch: {
- goodsData: {
- handler: function (el) {//监听对象的变换使用 function,箭头函数容易出现this指向不正确
- this.goodsData = el
- },
- deep: true
- }
- },
- computed: {
- },
- methods:{
- changeHandle (index) {//输入框的值被改变后
- this.goodsData[index].note = this.remark[index]
- this.$emit('handleGoodList',this.goodsData)
- }
- },
- }
- </script>
- <style lang="scss">
- .goods-template{
- width: 100%;
- height: auto;
- background: #FFFFFF;
- float: left;
- margin-top: 24rpx;
- .goods-list{
- width: 100%;
- height: auto;
- background:#F7F7F7;
- .goods-item{
- width: 100%;
- padding:20rpx;
- background: #FFFFFF;
- margin-bottom: 24rpx;
- &:last-child{
- margin-bottom: 0;
- }
- }
- .shoptitle{
- display: flex;
- align-items: center;
- height: 80rpx;
- line-height: 80rpx;
- .title-logo{
- width: 48rpx;
- height: 48rpx;
- float: left;
- image{
- width: 48rpx;
- height: 48rpx;
- }
- }
- .title-text{
- float: left;
- margin-left: 16rpx;
- font-size: $font-size-28;
- color: $text-color;
- text-align: left;
- line-height: 56rpx;
- font-weight: bold;
- }
- }
- .productlist{
- width: 100%;
- height: auto;
- }
- .goods-pros-t{
- display: flex;
- align-items: center;
- width: 100%;
- height: 217rpx;
- padding:12rpx 0;
- .pros-img{
- width: 210rpx;
- height: 100%;
- border-radius: 10rpx;
- margin:0 26rpx 0 0;
- border:1px solid #f3f3f3;
- image{
- width: 100%;
- height: 100%;
- border-radius: 10rpx;
- }
- }
- }
- .pros-product{
- width: 468rpx;
- height: 100%;
- line-height: 36rpx;
- font-size: $font-size-26;
- position: relative;
- .producttitle{
- width: 100%;
- display: inline-block;
- height: auto;
- text-overflow:ellipsis;
- display: -webkit-box;
- word-break: break-all;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- margin-bottom: 8rpx;
- }
- .productspec{
- height: 36rpx;
- color: #999999;
- }
- .productprice{
- height: 48rpx;
- position: absolute;
- width: 100%;
- bottom: 0;
- .price{
- line-height: 48rpx;
- font-size: $font-size-28;
- width: 48%;
- color: #FF2A2A;
- float: left;
- .small{
- font-size: $font-size-22;
- }
- }
- .count{
- height: 100%;
- float: right;
- position: relative;
- .small{
- color: #666666;
- }
- }
- }
- }
- .goods-pros-m{
- height: 76rpx;
- line-height: 76rpx;
- font-size: $font-size-26;
- color: $text-color;
- margin-top: 12rpx;
- .m-text{
- width: 90rpx;
- float: left;
- padding-right: 20rpx;
- }
- .m-input{
- position: relative;
- float: left;
- width: 620rpx;
- height: 70rpx;
- padding: 20rpx 40rpx;
- background: #F7F7F7;
- border-radius: 50rpx;
- input{
- width: 100%;
- height: 100%;
- background: #F7F7F7;
- font-size: $font-size-26;
- line-height: 36rpx;
- color: #333333;
- min-height: 36rpx;
- }
- }
- }
- .goods-pros-b{
- width:100%;
- height: auto;
- .sum{
- font-size: $font-size-28;
- line-height: 60rpx;
- color: $text-color;
- display: flex;
- justify-content: flex-end;
- .money{
- color: #FF2A2A;
- font-size: $font-size-28;
- }
- }
- }
- }
- }
- </style>
|