sellerOrderButton.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template name="button">
  2. <view class="button-template">
  3. <!-- 底部按钮 -->
  4. <view class="button-content">
  5. <view class="btn btn-cancel" v-if="secondHandOrderFlag!=1 && !rechargeGoods" @click.stop="btnConfirm('again',orderId)">再来一单</view>
  6. <view class="btn btn-cancel" v-if="btnState.isCancel" @click.stop="btnConfirm('cancel',orderId)">取消订单</view>
  7. <!-- <view class="btn btn-cancel" v-if="btnState.isDelete" @click.stop="btnConfirm('delete',orderId)">删除订单</view> -->
  8. <template>
  9. <view class="btn btn-cancel" v-if="btnState.isPay" @click.stop="onShareCode(orderId,userId,1)">分享支付</view>
  10. <view class="btn btn-cancel" v-else @click.stop="onShareCode(orderId,userId,2)">分享订单</view>
  11. </template>
  12. <view class="btn btn-query" v-if="btnState.isQuery && order.secondHandOrderFlag!=1" @click.stop="btnConfirm('query',orderId)">查看物流</view>
  13. <view class="btn btn-color" v-if="btnState.isConfirm" @click.stop="btnConfirm('confirm',orderId)">确认订单</view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default{
  19. name:'button',
  20. props:{
  21. status: {
  22. type:Number
  23. },
  24. order: {
  25. type:Object
  26. },
  27. orderId: {
  28. type:Number
  29. },
  30. userId:{
  31. type:Number
  32. },
  33. rechargeGoods:{
  34. type:Boolean
  35. },
  36. serviceProviderId:{
  37. type:Number
  38. },
  39. secondHandOrderFlag:{
  40. type:String
  41. }
  42. },
  43. data() {
  44. return{
  45. isShare:true,
  46. shareCode:'',
  47. btnState:this.initStatus(),
  48. mapStateArr:[
  49. {label:'isQuery',val:[4,5,12,13,33,22,23,32,77],status: true},
  50. {label:'isDelete',val:[6],status: true},
  51. {label:'isCancel',val:[0,111],status: true},
  52. {label:'isConfirm',val:[0],status: true},
  53. {label:'isPay',val:[11,12,13,21,22,23,111],status: true},
  54. ]
  55. }
  56. },
  57. created(){
  58. this.initData(this.status)
  59. },
  60. computed: {
  61. },
  62. watch:{
  63. status:{
  64. handler:function(val){
  65. this.initData(val)
  66. },
  67. deep:true//对象内部的属性监听,也叫深度监听
  68. }
  69. },
  70. methods:{
  71. initData(resVal) {
  72. /**
  73. * @分享按钮统一显示
  74. * @按钮根据状态显示
  75. * @(4、5、7、12、22、23、32)显示[查看物流]按钮,其他隐藏
  76. * @(6)显示[删除订单],其他隐藏
  77. * @(0、111)显示[取消订单],其他隐藏
  78. * @(21,31)只显示分享
  79. * @(13,33)显示[确认收货]和[查看物流]
  80. */
  81. this.btnState = this.initStatus()
  82. this.mapStateArr.forEach(el => {
  83. el.val.forEach(value => {
  84. if(resVal === value){
  85. this.btnState[el.label] = el.status
  86. }
  87. })
  88. })
  89. },
  90. initStatus(){
  91. let btnState= {
  92. isDelete: false,
  93. isCancel: false,
  94. isConfirm: false,
  95. isShare: true
  96. }
  97. return btnState
  98. },
  99. getShareCode(code){
  100. this.shareCode = code
  101. },
  102. onShareCode(oID,uID,type){
  103. if(this.order.onlinePayFlag == 1){
  104. this.$util.modal('提示','本订单不能进行线上支付,请让客户选择线下转账方式付款','继续分享','知道了',true,() =>{
  105. this.$parent.isShareModal = true
  106. this.$parent.btnoRderID = oID,
  107. this.$parent.btnClubUserID = uID
  108. this.$parent.isShareType = type
  109. this.$emit('shareConfirm')
  110. })
  111. }else{
  112. this.$parent.isShareModal = true
  113. this.$parent.btnoRderID = oID,
  114. this.$parent.btnClubUserID = uID
  115. this.$parent.isShareType = type
  116. this.$emit('shareConfirm')
  117. }
  118. },
  119. btnConfirm(type,orderId){
  120. let data = {
  121. type:type,
  122. orderId:orderId,
  123. }
  124. this.$emit('buttonConfirm',data)
  125. },
  126. }
  127. }
  128. </script>
  129. <style lang="scss">
  130. .button-template{
  131. width: 100%;
  132. height: auto;
  133. float: left;
  134. background: #FFFFFF;
  135. .button-content{
  136. height: auto;
  137. float: right;
  138. position: relative;
  139. margin: 20rpx 0;
  140. .share-code{
  141. width: 200rpx;
  142. height: 64rpx;
  143. line-height: 64rpx;
  144. color: #2A45FF;
  145. text-align: left;
  146. position: absolute;
  147. font-size: $font-size-28;
  148. font-weight: bold;
  149. left: 24rpx;
  150. top: 24rpx;
  151. }
  152. .btn{
  153. width: 160rpx;
  154. height: 64rpx;
  155. line-height: 64rpx;
  156. font-size:$font-size-26;
  157. color: #FFFFFF;
  158. text-align: center;
  159. border-radius:34rpx;
  160. // float: right;
  161. display: inline-block;
  162. }
  163. .btn-color{
  164. background: $btn-confirm;
  165. // margin: 22rpx 0 22rpx 22rpx;
  166. }
  167. .btn-cancel{
  168. border: 2rpx solid #999999;
  169. background:#FFFFFF;
  170. color: #666666;
  171. // float: left;
  172. margin-right: 15rpx;
  173. }
  174. .btn-delete{
  175. background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  176. }
  177. .btn-query{
  178. background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  179. }
  180. .btn-confirm{
  181. background:linear-gradient(315deg,rgba(231,0,0,1) 0%,rgba(255,104,1,1) 100%);
  182. }
  183. .btn-share{
  184. background:linear-gradient(315deg,rgba(0,212,150,1) 0%,rgba(126,243,174,1) 100%);
  185. margin-right: 0;
  186. position: relative;
  187. .tips{
  188. width: 160rpx;
  189. height: 34rpx;
  190. padding: 10rpx 10rpx;
  191. background:#FF5B00;
  192. border-radius: 8rpx;
  193. position: absolute;
  194. color: #FFFFFF;
  195. line-height: 34rpx;
  196. font-size: $font-size-24;
  197. text-align: left;
  198. right: 0;
  199. top: -65rpx;
  200. &:before{
  201. content: "";
  202. width: 25rpx;
  203. height: 25rpx;
  204. background:#FF5B00;
  205. position: absolute;
  206. bottom: -8rpx;
  207. left: 30rpx;
  208. z-index: -1;
  209. transform:rotate(45deg);
  210. }
  211. }
  212. }
  213. }
  214. }
  215. </style>