particulars.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <view class="app-content">
  3. <view class="billing_box_bg">
  4. <view class="top-view"></view>
  5. <view class="result-view">
  6. <view :class="['iconfont', 'iconchenggong']"></view>
  7. <view class="result-title">下单成功</view>
  8. <button class="admin-button-com big" style="width:70vw;" @click="goDetail">订单详情</button>
  9. <button v-if="ghsCgScene!=''" class="admin-button-com big" style="width:70vw;margin-top:18upx;" @click="goHome">返回首页</button>
  10. <button v-else class="admin-button-com big" style="width:70vw;margin-top:18upx;" @click="goBack">返回</button>
  11. <view style="margin-top:15upx;" v-if="showFirstGuide">
  12. <view style="font-size:28upx;">微信下拉,搜索小程序 花掌柜,可再次买花</view>
  13. <view style="margin-bottom:30upx;margin-top:15upx;">
  14. <image style="width:70vw;" :src="`${constant.imgUrl}/cg/hd_cg_route3.png`" mode="widthFix"></image>
  15. </view>
  16. </view>
  17. <view style="margin-top:10upx;" v-else>
  18. <view style="margin-bottom:10upx;margin-top:10upx;">
  19. <image style="width:86vw;" :src="`${constant.imgUrl}/cg/hd_cg_route4.png`" mode="widthFix"></image>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- #ifdef MP-WEIXIN -->
  24. <view style="width:690upx;height:25upx;background-color: #f5f5f5;"></view>
  25. <ad-custom unit-id="adunit-b3f48f1b6c1a39ff"></ad-custom>
  26. <!-- #endif -->
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import { getCgItemInfo } from "@/api/purchase";
  32. import { batchChangePrice } from '@/api/product';
  33. import { mapGetters } from "vuex";
  34. import { CURRENT_ENV } from "@/config";
  35. export default {
  36. name: "AppResult",
  37. data() {
  38. return {
  39. hasInit:false,
  40. ghsCgScene:'',
  41. currentEnv:'production',
  42. fromCg:0,
  43. flowersList:[],
  44. onlyCg:1,
  45. showFirstGuide:true
  46. }
  47. },
  48. onLoad () {
  49. this.hasInit = true
  50. const storageKey = 'particularsVisitCount'
  51. let visitCount = Number(uni.getStorageSync(storageKey) || 0) + 1
  52. uni.setStorageSync(storageKey, visitCount)
  53. this.showFirstGuide = visitCount <= 3
  54. //供货商打开太阳码分享给客户,客户需要采购进来
  55. let scene = uni.getStorageSync('ghsCgScene')
  56. if(scene){
  57. this.ghsCgScene = scene
  58. }
  59. //供货商打开小程序分享给客户,客户需要采购进来
  60. let ghsCgOption = uni.getStorageSync('ghsCgOption')
  61. if(ghsCgOption.fromCg){
  62. this.fromCg = ghsCgOption.fromCg
  63. }
  64. this.getCgItemFn()
  65. //当前环境
  66. this.currentEnv = CURRENT_ENV
  67. },
  68. onShow () {
  69. if(this.hasInit == false){
  70. this.$store.commit("setLoginInfo", {})
  71. }
  72. },
  73. computed: {
  74. ...mapGetters(['getDictionariesInfo']),
  75. },
  76. methods: {
  77. init(){
  78. },
  79. commit(){
  80. let that = this
  81. let hasError = false
  82. let name = ''
  83. this.flowersList.forEach((ele)=>{
  84. if(this.$util.isMoney(ele.changePrice) == false || Number(ele.changePrice)<0){
  85. hasError = true
  86. name = ele.name
  87. }
  88. })
  89. if(hasError){
  90. this.$msg('请填写 '+name+' 价格')
  91. return false
  92. }
  93. that.$util.confirmModal({content:'确认修改?'},() => {
  94. that.commitChange()
  95. })
  96. },
  97. commitChange(){
  98. let arr = this.flowersList.map((ele)=>{
  99. return {id:ele.productId,price:ele.changePrice}
  100. })
  101. let that = this
  102. uni.showLoading({mask:true})
  103. batchChangePrice({data:JSON.stringify(arr)}).then(res=>{
  104. if(res.code == 1){
  105. that.$msg('修改成功')
  106. }
  107. })
  108. },
  109. getCgItemFn(){
  110. let id = this.option.id ? this.option.id : 0
  111. let that = this
  112. getCgItemInfo({id:id}).then(res=>{
  113. if(res.code == 1){
  114. that.onlyCg = res.data.onlyCg
  115. let list = res.data.list ? res.data.list : []
  116. if(!this.$util.isEmpty(list)){
  117. let arr = list.map((ele)=>{
  118. return {...ele,changePrice:''}
  119. })
  120. that.flowersList = arr
  121. }
  122. }
  123. })
  124. },
  125. goBack(){
  126. uni.navigateBack()
  127. //this.subscribe()
  128. },
  129. goHome () {
  130. uni.removeStorageSync('ghsCgScene')
  131. uni.removeStorageSync('ghsCgOption')
  132. this.pageTo({url:"/admin/home/workbench",type:4})
  133. //this.subscribe()
  134. },
  135. goDetail() {
  136. uni.removeStorageSync('ghsCgScene')
  137. uni.removeStorageSync('ghsCgOption')
  138. this.pageTo({url: '/pagesPurchase/purDetails?id='+this.option.id+'&status=2',type:2})
  139. //this.subscribe()
  140. },
  141. subscribe(){
  142. // #ifdef MP-WEIXIN
  143. if(this.getDictionariesInfo && this.getDictionariesInfo.subscribeMessage && this.getDictionariesInfo.subscribeMessage == 1 && this.getDictionariesInfo.hdMiniMessage && this.getDictionariesInfo.hdMiniMessage.cgSuccess && this.getDictionariesInfo.hdMiniMessage.remindHdClear && this.getDictionariesInfo.hdMiniMessage.fhNotice){
  144. uni.requestSubscribeMessage({
  145. tmplIds: [this.getDictionariesInfo.hdMiniMessage.cgSuccess.msgId,this.getDictionariesInfo.hdMiniMessage.fhNotice.msgId,this.getDictionariesInfo.hdMiniMessage.remindHdClear.msgId],
  146. success(res) {
  147. console.log(res)
  148. },
  149. fail(err) {
  150. console.log(err)
  151. },
  152. complete() {
  153. }
  154. })
  155. }
  156. // #endif
  157. }
  158. },
  159. };
  160. </script>
  161. <style lang="scss" scoped>
  162. .go-back{
  163. width: 80%;
  164. height: 80upx;
  165. color: #FFFFFF;
  166. margin-top: 50upx;
  167. background: #3385FF;
  168. border-radius: 10upx;
  169. font-size:30upx;
  170. }
  171. .title{
  172. font-weight:700;
  173. margin-bottom:30upx;
  174. font-size:30upx;
  175. }
  176. .product-area{
  177. width:730upx;
  178. height:90upx;
  179. display:flex;
  180. align-items:center;
  181. .first-area{
  182. border-bottom:1upx solid #e4e2e2;
  183. position:relative;
  184. width:550upx;
  185. .name{
  186. width:280upx;
  187. overflow: hidden;
  188. text-overflow:ellipsis;
  189. white-space: nowrap;
  190. display:inline-block;
  191. font-weight:bold;
  192. font-size:28upx;
  193. }
  194. .cg-cost{
  195. font-weight:bold;
  196. font-size:27upx;
  197. color:red;
  198. position:absolute;
  199. left:480upx;
  200. top:8upx;
  201. }
  202. .cost-price{
  203. font-weight:bold;
  204. font-size:27upx;
  205. color:blue;
  206. position:absolute;
  207. left:515upx;
  208. top:18upx;
  209. }
  210. input{
  211. border:1upx solid #cccccc;
  212. display:inline-block;
  213. width:135upx;
  214. margin-left:10upx;
  215. margin-right:30upx;
  216. text-align:center;
  217. font-size:30upx;
  218. }
  219. }
  220. .second-area{
  221. float:left;
  222. color:#646464;
  223. margin-top:10upx;
  224. .one{
  225. color:red;
  226. }
  227. .two{
  228. color:#CCCCCC;
  229. }
  230. }
  231. }
  232. .billing_box_bg {
  233. position: relative;
  234. padding: 30upx 30upx 0upx 30upx;
  235. display: flex;
  236. flex-direction: column;
  237. background-color: #f5f5f5;
  238. .top-view {
  239. position: absolute;
  240. top: 0;
  241. left: 0;
  242. width: 100%;
  243. height: 299upx;
  244. background: #3385ff;
  245. border-radius: 0upx 0upx 83upx 83upx;
  246. }
  247. .result-view {
  248. position: relative;
  249. display: flex;
  250. flex-direction: column;
  251. align-items: center;
  252. padding: 20upx 70upx 0upx 70upx;
  253. width: 100%;
  254. background: #ffffff;
  255. border-radius: 20upx 20upx 0upx 0upx;
  256. z-index: 1;
  257. .iconchenggong {
  258. font-size: 100upx;
  259. color: $mainColor1;
  260. }
  261. .result-title {
  262. margin: 20upx 0 30upx;
  263. font-size: 32upx;
  264. }
  265. .close_btn {
  266. line-height: 88upx;
  267. text-align: center;
  268. width: 550upx;
  269. height: 88upx;
  270. border: 1px solid #dddddd;
  271. border-radius: 8upx;
  272. font-size: 32upx;
  273. color: #666;
  274. }
  275. }
  276. .admin-button-com {
  277. margin-bottom: 20upx;
  278. width: 100%;
  279. }
  280. }
  281. </style>