sellerDetaileButton.vue 6.5 KB

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