supplierListButton.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template name="button">
  2. <view class="button-template clearfix">
  3. <!-- 底部按钮 -->
  4. <view class="btn btn-color" v-if="btnState.isDeliver" @click.stop="btnConfirm('deliver',orderInfo)">发货</view>
  5. <view class="btn btn-cancel" @click.stop="onShareCode(orderInfo.shopOrderId)">
  6. <view class="tips" v-if="shareCode">分享码:{{shareCode}}</view>
  7. 分享订单
  8. </view>
  9. <view class="btn btn-cancel" v-if="btnState.isRecord" @click.stop="btnConfirm('record',orderInfo)">发货记录</view>
  10. </view>
  11. </template>
  12. <script>
  13. export default{
  14. name:"button",
  15. props:{
  16. status:{
  17. type:Number
  18. },
  19. orderInfo:{
  20. type:Object
  21. },
  22. shareCode:{
  23. type:String,
  24. default: ''
  25. }
  26. },
  27. watch:{
  28. status:{
  29. handler:function(val){
  30. this.initData(val)
  31. },
  32. deep:true//对象内部的属性监听,也叫深度监听
  33. }
  34. },
  35. data() {
  36. return{
  37. btnState:this.initStatus(),
  38. isIphoneX:this.$store.state.isIphoneX,
  39. mapStateArr:[
  40. {label:'isDeliver',val:[1,2],status: true},
  41. {label:'isRecord',val:[2,3],status: true},
  42. ]
  43. }
  44. },
  45. created(){
  46. this.initData(this.status)
  47. },
  48. computed: {
  49. },
  50. methods:{
  51. initData(resVal) {
  52. /**
  53. * @分享按钮统一显示
  54. * @按钮根据状态显示
  55. * @(1,2)显示[发货]按钮
  56. */
  57. this.btnState = this.initStatus()
  58. this.mapStateArr.forEach(el => {
  59. el.val.forEach(value => {
  60. if(resVal === value){
  61. this.btnState[el.label] = el.status
  62. console.log(this.btnState[el.label]);
  63. }
  64. })
  65. })
  66. },
  67. initStatus(){
  68. let btnState= {
  69. isDeliver: false,
  70. isRecord: false,
  71. }
  72. return btnState
  73. },
  74. getShareCode(code){
  75. this.shareCode = code
  76. },
  77. onShareCode(shopOrderId){
  78. this.$parent.isShareModal = true
  79. this.$parent.btnoRderID = shopOrderId
  80. this.$emit('shareConfirm')
  81. },
  82. btnConfirm(type,orderInfo){
  83. let data = {type:type, orderInfo:orderInfo}
  84. this.$emit('buttonConfirm',data)
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss">
  90. .button-template{
  91. width: 100%;
  92. height: auto;
  93. background-color: #FFF;
  94. // -webkit-box-shadow: 0px 3px 10px rgba(51, 51, 51, 0.5);
  95. // box-shadow: 0px 3px 10px rgba(51, 51, 51, 0.5);
  96. z-index: 999;
  97. box-sizing: border-box;
  98. .share-code{
  99. width: 200rpx;
  100. height: 64rpx;
  101. line-height: 64rpx;
  102. color: #2A45FF;
  103. text-align: left;
  104. position: absolute;
  105. font-size: $font-size-28;
  106. font-weight: bold;
  107. left: 24rpx;
  108. top: 24rpx;
  109. }
  110. .btn{
  111. width: 160rpx;
  112. height: 64rpx;
  113. margin:22rpx;
  114. line-height: 64rpx;
  115. font-size:$font-size-26;
  116. color: #FFFFFF;
  117. text-align: center;
  118. border-radius: 34rpx;
  119. float: right;
  120. margin-right: 0;
  121. }
  122. .btn-color{
  123. background: #ff7a51;
  124. }
  125. .btn-cancel{
  126. background:#FFFFFF;
  127. color: #666666;
  128. border: 1px solid #666666;
  129. .tips{
  130. width: 160rpx;
  131. height: 34rpx;
  132. padding: 10rpx 10rpx;
  133. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  134. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  135. border-radius: 8rpx;
  136. position: absolute;
  137. color: #FFFFFF;
  138. line-height: 34rpx;
  139. font-size: $font-size-24;
  140. text-align: left;
  141. right: 24rpx;
  142. top: -45rpx;
  143. &:before{
  144. content: "";
  145. width: 25rpx;
  146. height: 25rpx;
  147. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  148. position: absolute;
  149. bottom: -8rpx;
  150. right: 30rpx;
  151. z-index: -1;
  152. transform:rotate(45deg);
  153. }
  154. }
  155. }
  156. .btn-delete{
  157. background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  158. }
  159. .btn-query{
  160. background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  161. }
  162. .btn-confirm{
  163. background:linear-gradient(315deg,rgba(231,0,0,1) 0%,rgba(255,104,1,1) 100%);
  164. }
  165. .btn-share{
  166. background:linear-gradient(315deg,rgba(0,212,150,1) 0%,rgba(126,243,174,1) 100%);
  167. margin-right: 0;
  168. position: relative;
  169. .tips{
  170. width: 160rpx;
  171. height: 34rpx;
  172. padding: 10rpx 10rpx;
  173. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  174. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  175. border-radius: 8rpx;
  176. position: absolute;
  177. color: #FFFFFF;
  178. line-height: 34rpx;
  179. font-size: $font-size-24;
  180. text-align: left;
  181. right: 0;
  182. top: -65rpx;
  183. &:before{
  184. content: "";
  185. width: 25rpx;
  186. height: 25rpx;
  187. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  188. position: absolute;
  189. bottom: -8rpx;
  190. right: 30rpx;
  191. z-index: -1;
  192. transform:rotate(45deg);
  193. }
  194. }
  195. }
  196. }
  197. </style>