supplierListButton.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. console.log(this.status)
  47. this.initData(this.status)
  48. },
  49. computed: {
  50. },
  51. methods:{
  52. initData(resVal) {
  53. /**
  54. * @分享按钮统一显示
  55. * @按钮根据状态显示
  56. * @(1,2)显示[发货]按钮
  57. */
  58. this.btnState = this.initStatus()
  59. this.mapStateArr.forEach(el => {
  60. el.val.forEach(value => {
  61. if(resVal === value){
  62. this.btnState[el.label] = el.status
  63. console.log(this.btnState[el.label]);
  64. }
  65. })
  66. })
  67. },
  68. initStatus(){
  69. let btnState= {
  70. isDeliver: false,
  71. isRecord: false,
  72. }
  73. return btnState
  74. },
  75. getShareCode(code){
  76. this.shareCode = code
  77. },
  78. onShareCode(shopOrderID){
  79. console.log(shopOrderID)
  80. this.$parent.isShareModal = true
  81. this.$parent.btnoRderID = shopOrderID
  82. this.$emit('shareConfirm')
  83. },
  84. btnConfirm(type,orderInfo){
  85. console.log(orderInfo)
  86. let data = {type:type, orderInfo:orderInfo}
  87. this.$emit('buttonConfirm',data)
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="scss">
  93. .button-template{
  94. width: 100%;
  95. height: auto;
  96. background-color: #FFF;
  97. // -webkit-box-shadow: 0px 3px 10px rgba(51, 51, 51, 0.5);
  98. // box-shadow: 0px 3px 10px rgba(51, 51, 51, 0.5);
  99. z-index: 999;
  100. box-sizing: border-box;
  101. .share-code{
  102. width: 200rpx;
  103. height: 64rpx;
  104. line-height: 64rpx;
  105. color: #2A45FF;
  106. text-align: left;
  107. position: absolute;
  108. font-size: $font-size-28;
  109. font-weight: bold;
  110. left: 24rpx;
  111. top: 24rpx;
  112. }
  113. .btn{
  114. width: 160rpx;
  115. height: 64rpx;
  116. margin:22rpx;
  117. line-height: 64rpx;
  118. font-size:$font-size-26;
  119. color: #FFFFFF;
  120. text-align: center;
  121. border-radius: 34rpx;
  122. float: right;
  123. margin-right: 0;
  124. }
  125. .btn-color{
  126. background: #ff7a51;
  127. }
  128. .btn-cancel{
  129. background:#FFFFFF;
  130. color: #666666;
  131. border: 1px solid #666666;
  132. .tips{
  133. width: 160rpx;
  134. height: 34rpx;
  135. padding: 10rpx 10rpx;
  136. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  137. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  138. border-radius: 8rpx;
  139. position: absolute;
  140. color: #FFFFFF;
  141. line-height: 34rpx;
  142. font-size: $font-size-24;
  143. text-align: left;
  144. right: 24rpx;
  145. top: -45rpx;
  146. &:before{
  147. content: "";
  148. width: 25rpx;
  149. height: 25rpx;
  150. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  151. position: absolute;
  152. bottom: -8rpx;
  153. right: 30rpx;
  154. z-index: -1;
  155. transform:rotate(45deg);
  156. }
  157. }
  158. }
  159. .btn-delete{
  160. background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  161. }
  162. .btn-query{
  163. background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  164. }
  165. .btn-confirm{
  166. background:linear-gradient(315deg,rgba(231,0,0,1) 0%,rgba(255,104,1,1) 100%);
  167. }
  168. .btn-share{
  169. background:linear-gradient(315deg,rgba(0,212,150,1) 0%,rgba(126,243,174,1) 100%);
  170. margin-right: 0;
  171. position: relative;
  172. .tips{
  173. width: 160rpx;
  174. height: 34rpx;
  175. padding: 10rpx 10rpx;
  176. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  177. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  178. border-radius: 8rpx;
  179. position: absolute;
  180. color: #FFFFFF;
  181. line-height: 34rpx;
  182. font-size: $font-size-24;
  183. text-align: left;
  184. right: 0;
  185. top: -65rpx;
  186. &:before{
  187. content: "";
  188. width: 25rpx;
  189. height: 25rpx;
  190. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  191. position: absolute;
  192. bottom: -8rpx;
  193. right: 30rpx;
  194. z-index: -1;
  195. transform:rotate(45deg);
  196. }
  197. }
  198. }
  199. }
  200. </style>